diff --git a/docs/developers-info.rst b/docs/developers-info.rst
index dc2c2af3..0e825497 100644
--- a/docs/developers-info.rst
+++ b/docs/developers-info.rst
@@ -1,131 +1,135 @@
 Developers Information
 ======================
 
 Sample configuration
 --------------------
 
 The configuration will be taken from the default configuration file: *~/.config/swh/webapp/webapp.yml*.
 The following introduces a default configuration file:
 
 .. sourcecode:: yaml
 
     storage:
-    cls: remote
-    args:
-        url: http://localhost:5002
+        cls: remote
+        args:
+            url: http://localhost:5002
     debug: false
     throttling:
         cache_uri: None
         scopes:
             swh_api:
-            limiter_rate: 120/h
-            exempted_networks:
-                - 127.0.0.0/8
+                limiter_rate:
+                    default: 120/h
+                exempted_networks:
+                    - 127.0.0.0/8
 
 Run server
 ----------
 
 Either use the django manage script directly (useful in development mode as it offers various commands):
 
 .. sourcecode:: shell
 
     $ python3 -m swh.web.manage runserver
 
 or use the following shortcut:
 
 .. sourcecode:: shell
 
     $ make run
 
 Modules description
 -------------------
 
 Common to all web applications
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Configuration and settings
 """"""""""""""""""""""""""
 
     * :mod:`swh.web.config`: holds the SWH configuration for the web applications.
     * :mod:`swh.web.doc_config`: utility module used to extend the sphinx configuration
       when building the documentation.
     * :mod:`swh.web.manage`: Django management module for developpers.
     * :mod:`swh.web.urls`: module that holds the whole URI scheme of all
       the web applications.
     * :mod:`swh.web.wsgi`: WSGI module to use when deploying the web applications
       in production.
     * :mod:`swh.web.settings.common`: Common Django settings
     * :mod:`swh.web.settings.development`: Django settings for development
     * :mod:`swh.web.settings.production`: Django settings for production
     * :mod:`swh.web.settings.tests`: Django settings for tests
 
 Common utilities
 """"""""""""""""
 
     * :mod:`swh.web.common.converters`: conversion module used to transform SWH raw data
       to serializable ones. It is used by :mod:`swh.web.common.service`: to convert data
       before transmitting then to Django views.
     * :mod:`swh.web.common.exc`: module defining exceptions used in the web applications.
     * :mod:`swh.web.common.highlightjs`: utility module to ease the use of the highlightjs_
       library in produced Django views.
     * :mod:`swh.web.common.query`: Utilities to parse data from HTTP endpoints. It is used
       by :mod:`swh.web.common.service`.
     * :mod:`swh.web.common.service`: Orchestration layer used by views module
       in charge of communication with :mod:`swh.storage` to retrieve information and
       perform conversion for the upper layer.
     * :mod:`swh.web.common.swh_templatetags`: Custom Django template tags library for swh.
     * :mod:`swh.web.common.throttling`: Custom request rate limiter to use with the `Django REST Framework
       <http://www.django-rest-framework.org/>`_
     * :mod:`swh.web.common.urlsindex`: Utilities to help the registering of endpoints
       for the web applications
     * :mod:`swh.web.common.utils`: Utility functions used in the web applications implementation
 
 
 SWH Web API application
 ^^^^^^^^^^^^^^^^^^^^^^^
 
     * :mod:`swh.web.api.apidoc`: Utilities to document the web api for its html
       browsable rendering.
     * :mod:`swh.web.api.apiresponse`: Utility module to ease the generation of
       web api responses.
     * :mod:`swh.web.api.apiurls`: Utilities to facilitate the registration of SWH
       web api endpoints.
     * :mod:`swh.web.api.urls`: Module that defines the whole URI scheme for the api endpoints
     * :mod:`swh.web.api.utils`: Utility functions used in the SWH web api implementation.
     * :mod:`swh.web.api.views.content`: Implementation of API endpoints for getting information
       about SWH contents.
     * :mod:`swh.web.api.views.directory`: Implementation of API endpoints for getting information
       about SWH directories.
     * :mod:`swh.web.api.views.entity`: Implementation of API endpoints for getting information
       about SWH entities.
     * :mod:`swh.web.api.views.origin`: Implementation of API endpoints for getting information
       about SWH origins.
     * :mod:`swh.web.api.views.person`: Implementation of API endpoints for getting information
       about SWH persons.
     * :mod:`swh.web.api.views.release`: Implementation of API endpoints for getting information
       about SWH releases.
     * :mod:`swh.web.api.views.revision`: Implementation of API endpoints for getting information
       about SWH revisions.
+    * :mod:`swh.web.api.views.snapshot`: Implementation of API endpoints for getting information
+      about SWH snapshots.
     * :mod:`swh.web.api.views.stat`: Implementation of API endpoints for getting information
       about SWH archive statistics.
     * :mod:`swh.web.api.views.utils`: Utilities used in the web api endpoints implementation.
 
 SWH Web browse application
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
     * :mod:`swh.web.browse.browseurls`: Utilities to facilitate the registration of SWH web
       browse endpoints.
     * :mod:`swh.web.browse.urls`: Module that defines the whole URI scheme for the SWH web
       browse endpoints.
     * :mod:`swh.web.browse.utils`: Utilities functions used troughout the SWH web browse
       endpoints implementation.
     * :mod:`swh.web.browse.views.content`: Implementation of endpoints for browsing SWH contents.
     * :mod:`swh.web.browse.views.directory`: Implementation of endpoints for browsing SWH directories.
     * :mod:`swh.web.browse.views.identifiers`: Implementation of endpoints for browsing SWH objects
       through persistent identifiers.
     * :mod:`swh.web.browse.views.origin`: Implementation of endpoints for browsing SWH origins.
     * :mod:`swh.web.browse.views.person`: Implementation of endpoints for browsing SWH persons.
     * :mod:`swh.web.browse.views.release`: Implementation of endpoints for browsing SWH releases.
     * :mod:`swh.web.browse.views.revision`: Implementation of endpoints for browsing SWH revisions.
+    * :mod:`swh.web.browse.views.snapshot`: Implementation of endpoints for browsing SWH snapshots.
 
 .. _highlightjs: https://highlightjs.org/
diff --git a/docs/uri-scheme-browse-directory.rst b/docs/uri-scheme-browse-directory.rst
index bfd6ed04..4c8b9e5c 100644
--- a/docs/uri-scheme-browse-directory.rst
+++ b/docs/uri-scheme-browse-directory.rst
@@ -1,31 +1,31 @@
 Directory
 ^^^^^^^^^
 
 .. http:get:: /browse/directory/(sha1_git)/[(path)/]
 
     HTML view for browsing the content of a SWH directory reachable from
-    the provided root one (including itself) identified by its `sha1_git` value.
+    the provided root one (including itself) identified by its *sha1_git* value.
 
     The content of the directory is first sorted in lexicographical order
     and the sub-directories are displayed before the regular files.
 
     The view enables to navigate from the requested directory to
     directories reachable from it in a recursive way but also
     up to the root directory.
     A breadcrumb located in the top part of the view allows
     to keep track of the paths navigated so far.
 
     :param string sha1_git: hexadecimal representation for the *sha1_git* identifier
         of the directory to browse
-    :param string path: optional parameter used to specify the path of a directory 
+    :param string path: optional parameter used to specify the path of a directory
         reachable from the provided root one
     :statuscode 200: no error
     :statuscode 400: an invalid *sha1_git* value has been provided
     :statuscode 404: requested directory can not be found in the SWH archive
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`directory/977fc4b98c0e85816348cebd3b12026407c368b6/`
         :swh_web_browse:`directory/9650ed370c0330d2cd2b6fd1e9febf649ffe538d/kernel/sched/`
diff --git a/docs/uri-scheme-browse-identifiers.rst b/docs/uri-scheme-browse-identifiers.rst
index a5f54dbb..511d495b 100644
--- a/docs/uri-scheme-browse-identifiers.rst
+++ b/docs/uri-scheme-browse-identifiers.rst
@@ -1,29 +1,30 @@
 SWH identifiers
 ^^^^^^^^^^^^^^^
 
 A subset of Software Heritage objects (contents, directories, releases and revisions)
 can be browsed using :ref:`persistent-identifiers`. Those identifiers
 are guaranteed to remain stable (persistent) over time.
 
 .. http:get:: /browse/(swh_id)/
 
     End point to browse SWH objects using their persistent identifiers.
     A redirection to the adequate HTML view will be performed when
     reaching it.
 
     :param string swh_id: a persistent identifier for a SWH object
         (see the :ref:`persistent-identifiers` section to learn more
         about its syntax)
     :resheader Location: the redirection URL for browsing the SWH object
         associated to the provided identifier
     :statuscode 302: no error
     :statuscode 400: the provided identifier is malformed
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`swh:1:cnt:0ffd12d85cdec70c88e852fc3f5ea9fd342213cd`
         :swh_web_browse:`swh:1:dir:db990da9af15427455ce7836ce2b8a34b9bf67f5`
         :swh_web_browse:`swh:1:rel:a9b7e3f1eada90250a6b2ab2ef3e0a846cb16831`
-        :swh_web_browse:`swh:1:rev:f1b94134a4b879bc55c3dacdb496690c8ebdc03f`
\ No newline at end of file
+        :swh_web_browse:`swh:1:rev:f1b94134a4b879bc55c3dacdb496690c8ebdc03f`
+        :swh_web_browse:`swh:1:snp:673156c31a876c5b99b2fe3e89615529de9a3c44`
diff --git a/docs/uri-scheme-browse-origin.rst b/docs/uri-scheme-browse-origin.rst
index 158ccc92..d397bab4 100644
--- a/docs/uri-scheme-browse-origin.rst
+++ b/docs/uri-scheme-browse-origin.rst
@@ -1,491 +1,491 @@
 Origin
 ^^^^^^
 
 This describes the URI scheme when one wants to browse the Software Heritage
 archive in the context of an origin (for instance, a repository crawled from
 GitHub or a Debian source package). All the views pointed by that scheme
 offer quick links to browse objects as found during the associated crawls
 performed by Software Heritage:
 
     * the root directory of the origin
     * the list of branches of the origin
     * the list of releases of the origin
 
 Origin metadata
 """""""""""""""
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/
 
     HTML view that displays a SWH origin identified by its type and url.
 
     The view displays the origin metadata and contains links
     for browsing its directories and contents for each SWH visit.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/torvalds/linux/`
         :swh_web_browse:`origin/git/url/https://github.com/python/cpython/`
         :swh_web_browse:`origin/deb/url/deb://Debian-Security/packages/mediawiki/`
         :swh_web_browse:`origin/git/url/https://gitorious.org/qt/qtbase.git`
 
 
 Origin directory
 """"""""""""""""
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/directory/[(path)/]
 
     HTML view for browsing the content of a directory reachable from the root directory
     (including itself) associated to the latest full visit of a SWH origin.
 
     The content of the directory is first sorted in lexicographical order
     and the sub-directories are displayed before the regular files.
 
     The view enables to navigate from the requested directory to
     directories reachable from it in a recursive way but also
     up to the origin root directory.
     A breadcrumb located in the top part of the view allows
     to keep track of the paths navigated so far.
 
     The view also enables to easily switch between the origin branches
     and releases through a dropdown menu.
 
     The origin branch (default to master) from which to retrieve the directory
     content can also be specified by using the branch query parameter.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :param string path: optional parameter used to specify the path of a directory
         reachable from the origin root one
     :query string branch: specify the origin branch name from which
-        to retrieve the directory
+        to retrieve the root directory
     :query string release: specify the origin release name from which
-        to retrieve the directory
+        to retrieve the root directory
     :query string revision: specify the origin revision, identified by the hexadecimal
-        representation of its *sha1_git* value, from which to retrieve the directory
+        representation of its *sha1_git* value, from which to retrieve the root directory
     :query int visit_id: specify a SWH visit id to retrieve the directory from instead
-        of using the latest visit by default
+        of using the latest full visit by default
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive
         or the provided path does not exist from the origin root directory
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/torvalds/linux/directory/`
         :swh_web_browse:`origin/git/url/https://github.com/torvalds/linux/directory/net/ethernet/`
         :swh_web_browse:`origin/git/url/https://github.com/python/cpython/directory/`
         :swh_web_browse:`origin/git/url/https://github.com/python/cpython/directory/Python/`
         :swh_web_browse:`origin/git/url/https://github.com/python/cpython/directory/?branch=refs/heads/2.7`
 
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/directory/[(path)/]
 
     HTML view for browsing the content of a directory reachable from
-    the root directory (including itself) associated to a visitof a SWH
+    the root directory (including itself) associated to a visit of a SWH
     origin closest to a provided timestamp.
 
     The content of the directory is first sorted in lexicographical order
     and the sub-directories are displayed before the regular files.
 
     The view enables to navigate from the requested directory to
     directories reachable from it in a recursive way but also
     up to the origin root directory.
     A breadcrumb located in the top part of the view allows
     to keep track of the paths navigated so far.
 
     The view also enables to easily switch between the origin branches
     and releases through a dropdown menu.
 
     The origin branch (default to master) from which to retrieve the directory
     content can also be specified by using the branch query parameter.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :param string timestamp: a date string (any format parsable by `dateutil.parser.parse`_)
         or Unix timestamp to parse in order to find the closest SWH visit.
     :param path: optional parameter used to specify the path of a directory
         reachable from the origin root one
     :type path: string
     :query string branch: specify the origin branch name from which
-        to retrieve the directory
-    :query string revision: specify the origin release name from which
-        to retrieve the directory
+        to retrieve the root directory
+    :query string release: specify the origin release name from which
+        to retrieve the root directory
     :query string revision: specify the origin revision, identified by the hexadecimal
         representation of its *sha1_git* value, from which to retrieve the directory
     :query int visit_id: specify a SWH visit id to retrieve the directory from instead
         of using the provided timestamp
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive,
         requested visit timestamp does not exist or the provided path does
         not exist from the origin root directory
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/torvalds/linux/visit/1493926809/directory/`
         :swh_web_browse:`origin/git/url/https://github.com/torvalds/linux/visit/2016-09-14T10:36:21/directory/net/ethernet/`
         :swh_web_browse:`origin/git/url/https://github.com/python/cpython/visit/1474620651/directory/`
         :swh_web_browse:`origin/git/url/https://github.com/python/cpython/visit/2017-05-05/directory/Python/`
         :swh_web_browse:`origin/git/url/https://github.com/python/cpython/visit/2015-08/directory/?branch=refs/heads/2.7`
 
 
 Origin content
 """"""""""""""
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/content/(path)/
 
     HTML view that produces a display of a SWH content
     associated to the latest full visit of a SWH origin.
 
     If the content to display is textual, it will be highlighted client-side
     if possible using highlightjs_. The procedure to perform that task is described
     in :http:get:`/browse/content/[(algo_hash):](hash)/`.
 
     It is also possible to highlight specific lines of a textual
     content (not in terms of syntax highlighting but to emphasize
     some relevant content part) by either:
 
         * clicking on line numbers (holding shift to highlight a lines range)
 
         * using an url fragment in the form '#Ln' or '#Lm-Ln'
 
     The view displays a breadcrumb on top of the rendered
     content in order to easily navigate up to the origin root directory.
 
     The view also enables to easily switch between the origin branches
     and releases through a dropdown menu.
 
     The origin branch (default to master) from which to retrieve the content
     can also be specified by using the branch query parameter.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :param string path: path of a content reachable from the origin root directory
     :query string branch: specify the origin branch name from which
         to retrieve the content
     :query string release: specify the origin release name from which
         to retrieve the content
     :query string revision: specify the origin revision, identified by the hexadecimal
         representation of its *sha1_git* value, from which to retrieve the content
     :query int visit_id: specify a SWH visit id to retrieve the content from instead
-        of using the latest visit by default
+        of using the latest full visit by default
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive,
         or the provided content path does not exist from the origin root directory
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/git/git/content/git.c/`
         :swh_web_browse:`origin/git/url/https://github.com/git/git/content/git.c/`
         :swh_web_browse:`origin/git/url/https://github.com/mozilla/gecko-dev/content/js/src/json.cpp/`
         :swh_web_browse:`origin/git/url/https://github.com/git/git/content/git.c/?branch=refs/heads/next`
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/content/(path)/
 
     HTML view that produces a display of a SWH content associated to a
     visit of a SWH origin closest to a provided timestamp.
 
     If the content to display is textual, it will be highlighted client-side
     if possible using highlightjs_. The procedure to perform that task is described
     in :http:get:`/browse/content/[(algo_hash):](hash)/`.
 
     It is also possible to highlight specific lines of a textual
     content (not in terms of syntax highlighting but to emphasize
     some relevant content part) by either:
 
         * clicking on line numbers (holding shift to highlight a lines range)
 
         * using an url fragment in the form '#Ln' or '#Lm-Ln'
 
 
     The view displays a breadcrumb on top of the rendered
     content in order to easily navigate up to the origin root directory.
 
     The view also enables to easily switch between the origin branches
     and releases through a dropdown menu.
 
     The origin branch (default to master) from which to retrieve the content
     can also be specified by using the branch query parameter.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :param string timestamp: a date string (any format parsable by `dateutil.parser.parse`_)
         or Unix timestamp to parse in order to find the closest SWH visit.
     :param string path: path of a content reachable from the origin root directory
     :query string branch: specify the origin branch name from which
         to retrieve the content
     :query string release: specify the origin release name from which
         to retrieve the content
     :query string revision: specify the origin revision, identified by the hexadecimal
         representation of its *sha1_git* value, from which to retrieve the content
     :query int visit_id: specify a SWH visit id to retrieve the content from instead
         of using the provided timestamp
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive,
         requested visit timestamp does not exist or the provided content path does
         not exist from the origin root directory
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/git/git/visit/1473933564/content/git.c/`
         :swh_web_browse:`origin/git/url/https://github.com/git/git/visit/2016-05-05T00:0:00+00:00/content/git.c/`
         :swh_web_browse:`origin/git/url/https://github.com/mozilla/gecko-dev/visit/1490126182/content/js/src/json.cpp/`
         :swh_web_browse:`origin/git/url/https://github.com/mozilla/gecko-dev/visit/2017-03-21/content/js/src/json.cpp/#L904-L931`
         :swh_web_browse:`origin/git/url/https://github.com/git/git/visit/2017-09-15/content/git.c/?branch=refs/heads/next`
 
 
 Origin history
 """"""""""""""
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/log/
 
     HTML view that produces a display of revisions history heading
     to the last revision found during the latest visit of a SWH origin.
     In other words, it shows the commit log associated to the latest
     full visit of a SWH origin.
 
     The following data are displayed for each log entry:
 
         * author of the revision
         * link to the revision metadata
         * message associated the revision
         * date of the revision
         * link to browse the associated source tree in the origin context
 
     N log entries are displayed per page (default is 20). In order to navigate
     in a large history, two buttons are present at the bottom of the view:
 
         * *Newer*: fetch and display if available the N more recent log entries
           than the ones currently displayed
         * *Older*: fetch and display if available the N older log entries
           than the ones currently displayed
 
     The view also enables to easily switch between the origin branches
     and releases through a dropdown menu.
 
     The origin branch (default to master) from which to retrieve the content
     can also be specified by using the branch query parameter.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :query string revs_breadcrumb: used internally to store
         the navigation breadcrumbs (i.e. the list of descendant revisions
         visited so far). It must be a string in the form
         "(rev_1)[/(rev_2)/.../(rev_n)]" where rev_i corresponds to a
-        revision sha1_git.
+        revision *sha1_git*.
     :query int per_page: the number of log entries to display per page
         (default is 20, max is 50)
     :query string branch: specify the origin branch name from which
         to retrieve the commit log
     :query string release: specify the origin release name from which
         to retrieve the commit log
     :query string revision: specify the origin revision, identified by the hexadecimal
         representation of its *sha1_git* value, from which to retrieve the commit log
     :query int visit_id: specify a SWH visit id to retrieve the history log from instead
         of using the latest visit by default
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/videolan/vlc/log/`
         :swh_web_browse:`origin/git/url/https://github.com/Kitware/CMake/log/`
         :swh_web_browse:`origin/git/url/https://github.com/Kitware/CMake/log/?branch=refs/heads/release`
 
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/log/
 
     HTML view that produces a display of revisions history heading
     to the last revision found during a visit of a SWH origin closest
     to the provided timestamp.
     In other words, it shows the commit log associated to a visit of
     a SWH origin closest to a provided timestamp.
 
     The following data are displayed for each log entry:
 
         * author of the revision
         * link to the revision metadata
         * message associated the revision
         * date of the revision
         * link to browse the associated source tree in the origin context
 
     N log entries are displayed per page (default is 20). In order to navigate
     in a large history, two buttons are present at the bottom of the view:
 
         * *Newer*: fetch and display if available the N more recent log entries
           than the ones currently displayed
         * *Older*: fetch and display if available the N older log entries
           than the ones currently displayed
 
     The view also enables to easily switch between the origin branches
     and releases through a dropdown menu.
 
     The origin branch (default to master) from which to retrieve the content
     can also be specified by using the branch query parameter.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :param string timestamp: a date string (any format parsable by `dateutil.parser.parse`_)
         or Unix timestamp to parse in order to find the closest SWH visit.
     :query string revs_breadcrumb: used internally to store
         the navigation breadcrumbs (i.e. the list of descendant revisions
         visited so far). It must be a string in the form
         "(rev_1)[/(rev_2)/.../(rev_n)]" where rev_i corresponds to a
-        revision sha1_git.
+        revision *sha1_git*.
     :query int per_page: the number of log entries to display per page
         (default is 20, max is 50)
     :query string branch: specify the origin branch name from which
         to retrieve the commit log
     :query string release: specify the origin release name from which
         to retrieve the commit log
     :query string revision: specify the origin revision, identified by the hexadecimal
         representation of its *sha1_git* value, from which to retrieve the commit log
     :query int visit_id: specify a SWH visit id to retrieve the history log from instead
         of using the provided timestamp
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/videolan/vlc/visit/1459651262/log/`
         :swh_web_browse:`origin/git/url/https://github.com/Kitware/CMake/visit/2016-04-01/log/`
         :swh_web_browse:`origin/git/url/https://github.com/Kitware/CMake/visit/1438116814/log/?branch=refs/heads/release`
         :swh_web_browse:`origin/git/url/https://github.com/Kitware/CMake/visit/2017-05-05T03:14:23/log/?branch=refs/heads/release`
 
 Origin branches
 """""""""""""""
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/branches/
 
     HTML view that produces a display of the list of branches
     found during the latest full visit of a SWH origin.
 
     The following data are displayed for each branch:
 
         * its name
         * a link to browse the associated directory
         * a link to browse the associated revision
         * last commit message
         * last commit date
 
     That list of branches is paginated, each page displaying a maximum of 20 branches.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/deb/url/deb://Debian/packages/linux/branches/`
         :swh_web_browse:`origin/git/url/https://github.com/webpack/webpack/branches/`
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/branches/
 
     HTML view that produces a display of the list of branches
     found during a visit of a SWH origin closest to the provided timestamp.
 
     The following data are displayed for each branch:
 
         * its name
         * a link to browse the associated directory
         * a link to browse the associated revision
         * last commit message
         * last commit date
 
     That list of branches is paginated, each page displaying a maximum of 20 branches.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :param string timestamp: a date string (any format parsable by `dateutil.parser.parse`_)
         or Unix timestamp to parse in order to find the closest SWH visit.
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/kripken/emscripten/visit/2017-05-05T12:02:03/branches/`
         :swh_web_browse:`origin/deb/url/deb://Debian/packages/apache2-mod-xforward/visit/2017-11-15T05:15:09/branches/`
 
 Origin releases
 """""""""""""""
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/releases/
 
     HTML view that produces a display of the list of releases
     found during the latest full visit of a SWH origin.
 
     The following data are displayed for each release:
 
         * its name
         * a link to browse the release details
         * its target type (revision, directory, content or release)
         * its associated message
         * its date
 
     That list of releases is paginated, each page displaying a maximum of 20 releases.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/git/git/releases/`
         :swh_web_browse:`origin/git/url/https://github.com/webpack/webpack/releases/`
 
 .. http:get:: /browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/releases/
 
     HTML view that produces a display of the list of releases
     found during a visit of a SWH origin closest to the provided timestamp.
 
     The following data are displayed for each release:
 
         * its name
         * a link to browse the release details
         * its target type (revision, directory, content or release)
         * its associated message
         * its date
 
     That list of releases is paginated, each page displaying a maximum of 20 releases.
 
     :param string origin_type: the type of the SWH origin (*git*, *svn*, *deb* ...)
-    :param string origin_url: the url of the origin (e.g. https://github.com/user/repo)
+    :param string origin_url: the url of the origin (e.g. https://github.com/(user)/(repo)/)
     :param string timestamp: a date string (any format parsable by `dateutil.parser.parse`_)
         or Unix timestamp to parse in order to find the closest SWH visit.
     :statuscode 200: no error
     :statuscode 404: requested origin can not be found in the SWH archive
 
     **Examples:**
 
     .. parsed-literal::
 
         :swh_web_browse:`origin/git/url/https://github.com/torvalds/linux/visit/2017-11-21T19:37:42/releases/`
         :swh_web_browse:`origin/git/url/https://github.com/Kitware/CMake/visit/2016-09-23T14:06:35/releases/`
 
 .. _highlightjs: https://highlightjs.org/
 .. _dateutil.parser.parse: http://dateutil.readthedocs.io/en/stable/parser.html
diff --git a/docs/uri-scheme-browse-snapshot.rst b/docs/uri-scheme-browse-snapshot.rst
new file mode 100644
index 00000000..50bc9a16
--- /dev/null
+++ b/docs/uri-scheme-browse-snapshot.rst
@@ -0,0 +1,187 @@
+Snapshot
+^^^^^^^^
+
+.. http:get:: /browse/snapshot/(snapshot_id)/
+
+    HTML view that displays the content of a SWH snapshot from its identifier
+    (see :func:`swh.model.identifiers.snapshot_identifier`
+    in our data model module for details about how they are computed).
+
+    A snapshot is a set of named branches, which are pointers to objects at any
+    level of the Software Heritage DAG. It represents a full picture of an
+    origin at a given time. Thus, multiple visits of different origins can
+    point to the same snapshot (for instance, when several projects are forks
+    of a common one).
+
+    Currently, that endpoint simply performs a redirection to
+    :http:get:`/browse/snapshot/(snapshot_id)/directory/[(path)/]`
+    in order to display the root directory associated to the default
+    snapshot branch (usually master).
+
+    :param string snapshot_id: hexadecimal representation of the snapshot *sha1* identifier
+
+    :statuscode 200: no error
+    :statuscode 400: an invalid snapshot identifier has been provided
+    :statuscode 404: requested snapshot can not be found in the SWH archive
+
+    **Examples:**
+
+    .. parsed-literal::
+
+        :swh_web_browse:`snapshot/baebc2109e4a2ec22a1129a3859647e191d04df4/`
+        :swh_web_browse:`snapshot/673156c31a876c5b99b2fe3e89615529de9a3c44/`
+
+
+Snapshot directory
+""""""""""""""""""
+
+.. http:get:: /browse/snapshot/(snapshot_id)/directory/[(path)/]
+
+    HTML view that displays the content of a directory reachable from
+    a SWH snapshot.
+
+    The features offered by the view are similar to the one for browsing
+    a directory in an origin context
+    (see :http:get:`/browse/origin/(origin_type)/url/(origin_url)/directory/[(path)/]`).
+
+    :param string snapshot_id: hexadecimal representation of the snapshot *sha1* identifier
+    :param string path: optional parameter used to specify the path of a directory
+        reachable from the snapshot root one
+    :query string branch: specify the snapshot branch name from which
+        to retrieve the root directory
+    :query string release: specify the snapshot release name from which
+        to retrieve the root directory
+    :query string revision: specify the snapshot revision, identified by the hexadecimal
+        representation of its *sha1_git* value, from which to retrieve the root directory
+
+    :statuscode 200: no error
+    :statuscode 400: an invalid snapshot identifier has been provided
+    :statuscode 404: requested snapshot can not be found in the SWH archive
+
+    **Examples:**
+
+    .. parsed-literal::
+
+        :swh_web_browse:`snapshot/baebc2109e4a2ec22a1129a3859647e191d04df4/directory/drivers/gpu/`
+        :swh_web_browse:`snapshot/673156c31a876c5b99b2fe3e89615529de9a3c44/directory/src/opengl/`
+        :swh_web_browse:`snapshot/673156c31a876c5b99b2fe3e89615529de9a3c44/log/?release=v5.7.0`
+
+Snapshot content
+""""""""""""""""
+
+.. http:get:: /browse/snapshot/(snapshot_id)/content/(path)/
+
+    HTML view that produces a display of a SWH content reachable from
+    a SWH snapshot.
+
+    The features offered by the view are similar to the one for browsing
+    a content in an origin context
+    (see :http:get:`/browse/origin/(origin_type)/url/(origin_url)/content/(path)/`).
+
+    :param string snapshot_id: hexadecimal representation of the snapshot *sha1* identifier
+    :param string path: path of a content reachable from the snapshot root directory
+    :query string branch: specify the snapshot branch name from which
+        to retrieve the content
+    :query string release: specify the snapshot release name from which
+        to retrieve the content
+    :query string revision: specify the snapshot revision, identified by the hexadecimal
+        representation of its *sha1_git* value, from which to retrieve the content
+
+    :statuscode 200: no error
+    :statuscode 400: an invalid snapshot identifier has been provided
+    :statuscode 404: requested snapshot can not be found in the SWH archive,
+        or the provided content path does not exist from the origin root directory
+
+    **Examples:**
+
+    .. parsed-literal::
+
+        :swh_web_browse:`snapshot/baebc2109e4a2ec22a1129a3859647e191d04df4/content/init/initramfs.c`
+        :swh_web_browse:`snapshot/673156c31a876c5b99b2fe3e89615529de9a3c44/content/src/opengl/qglbuffer.h/`
+        :swh_web_browse:`snapshot/673156c31a876c5b99b2fe3e89615529de9a3c44/content/src/opengl/qglbuffer.h/?release=v5.0.0`
+
+Snapshot history
+""""""""""""""""
+
+.. http:get:: /browse/snapshot/(snapshot_id)/log/
+
+    HTML view that produces a display of revisions history (aka the commit log)
+    heading to the last revision collected in a SWH snasphot.
+
+    The features offered by the view are similar to the one for browsing
+    the history in an origin context
+    (see :http:get:`/browse/origin/(origin_type)/url/(origin_url)/log/`).
+
+    :param string snapshot_id: hexadecimal representation of the snapshot *sha1* identifier
+    :query string revs_breadcrumb: used internally to store
+        the navigation breadcrumbs (i.e. the list of descendant revisions
+        visited so far). It must be a string in the form
+        "(rev_1)[/(rev_2)/.../(rev_n)]" where rev_i corresponds to a
+        revision *sha1_git*.
+    :query int per_page: the number of log entries to display per page
+        (default is 20, max is 50)
+    :query string branch: specify the snapshot branch name from which
+        to retrieve the commit log
+    :query string release: specify the snasphot release name from which
+        to retrieve the commit log
+    :query string revision: specify the snapshot revision, identified by the hexadecimal
+        representation of its *sha1_git* value, from which to retrieve the commit log
+
+    :statuscode 200: no error
+    :statuscode 400: an invalid snapshot identifier has been provided
+    :statuscode 404: requested snapshot can not be found in the SWH archive
+
+    **Examples:**
+
+    .. parsed-literal::
+
+        :swh_web_browse:`snapshot/a274b44111f777209556e94920b7e71cf5c305cd/log/`
+        :swh_web_browse:`snapshot/9ca9e75279df5f4e3fee19bf5190ed672dcdfb33/log/?branch=refs/heads/emacs-unicode`
+
+Snapshot branches
+"""""""""""""""""
+
+.. http:get:: /browse/snapshot/(snapshot_id)/branches/
+
+    HTML view that produces a display of the list of branches
+    collected in a SWH snapshot.
+
+    The features offered by the view are similar to the one for browsing
+    the list of branches in an origin context
+    (see :http:get:`/browse/origin/(origin_type)/url/(origin_url)/branches/`).
+
+    :param string snapshot_id: hexadecimal representation of the snapshot *sha1* identifier
+    :statuscode 200: no error
+    :statuscode 400: an invalid snapshot identifier has been provided
+    :statuscode 404: requested snapshot can not be found in the SWH archive
+
+    **Examples:**
+
+    .. parsed-literal::
+
+        :swh_web_browse:`snapshot/03d7897352541e78ee7b13a580dc836778e8126a/branches/`
+        :swh_web_browse:`snapshot/f37563b953327f8fd83e39af6ebb929ef85103d5/branches/`
+
+Snapshot releases
+"""""""""""""""""
+
+.. http:get:: /browse/snapshot/(snapshot_id)/releases/
+
+    HTML view that produces a display of the list of releases
+    collected in a SWH snapshot.
+
+    The features offered by the view are similar to the one for browsing
+    the list of releases in an origin context
+    (see :http:get:`/browse/origin/(origin_type)/url/(origin_url)/releases/`).
+
+    :param string snapshot_id: hexadecimal representation of the snapshot *sha1* identifier
+    :statuscode 200: no error
+    :statuscode 400: an invalid snapshot identifier has been provided
+    :statuscode 404: requested snapshot can not be found in the SWH archive
+
+    **Examples:**
+
+    .. parsed-literal::
+
+        :swh_web_browse:`snapshot/673156c31a876c5b99b2fe3e89615529de9a3c44/releases/`
+        :swh_web_browse:`snapshot/23e6fb084a60cc909b9e222d80d89fdb98756dee/releases/`
\ No newline at end of file
diff --git a/docs/uri-scheme-browse.rst b/docs/uri-scheme-browse.rst
index ad43b2c4..3b9263bb 100644
--- a/docs/uri-scheme-browse.rst
+++ b/docs/uri-scheme-browse.rst
@@ -1,99 +1,101 @@
 URI scheme for SWH Web Browse application
 =========================================
 
 This web application aims to provide HTML views to easily navigate in the SWH archive,
 thus it needs to be reached from a web browser.
 If you intend to query the SWH archive programmatically through any HTTP client,
 please refer to the :ref:`swh-web-api-urls` section instead.
 
 Context-independent browsing
 ----------------------------
 
 Context-independent URLs provide information about SWH objects (e.g.,
 revisions, directories, contents, person, ...), independently of the
 contexts where they have been found (e.g., specific repositories,
 branches, commits, ...).
 
 The following endpoints are the same of the API case (see below), and
 just render the corresponding information for user consumption. Where
 hyperlinks are created, they always point to other context-independent
 user URLs:
 
     * :http:get:`/browse/content/[(algo_hash):](hash)/`: Display a SWH content
     * :http:get:`/browse/content/[(algo_hash):](hash)/raw/`: Get / Download SWH content raw data
     * :http:get:`/browse/directory/(sha1_git)/[(path)/]`: Browse the content of a SWH directory
     * :http:get:`/browse/person/(person_id)/`: Information on a SWH person
     * :http:get:`/browse/revision/(sha1_git)/`: Browse a SWH revision
     * :http:get:`/browse/revision/(sha1_git)/log/`: Browse history log heading to a SWH revision
 
 Context-dependent browsing
 --------------------------
 
 Context-dependent URLs provide information about SWH objects, limited to
 specific contexts where the objects have been found.
 
 For instance, instead of having to specify a (root) revision by *sha1_git*, users might want to
 specify a place and a time. In SWH a "place" is an origin, with an optional
 branch name; a "time" is a timestamp at which some place has been observed by
 SWH crawlers.
 
 Wherever a revision context is expected in a path (i.e., a
 **/browse/revision/(sha1_git)/** path fragment) we can put in its stead a path fragment
 of the form **/origin/(origin_type)/url/(origin_url)/[/visit/(timestamp)/][?branch=(branch)]**.
 Such a fragment is resolved, internally by the SWH archive, to a revision *sha1_git* as follows:
 
 - if *timestamp* is absent: look for the most recent crawl of origin
   identified by *origin_type* and *origin_url*
 - if *timestamp* is given: look for the closest crawl of origin identified
   by *origin_type* and *origin_url* from timestamp *timestamp*
 - if *branch* is given as a query parameter: look for the branch *branch*
 - if *branch* is absent: look for branch "HEAD" or "master"
 - return the revision *sha1_git* pointed by the chosen branch
 
 The already mentioned URLs for revision contexts can therefore be alternatively
 specified by users as:
 
 * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/directory/[(path)/]`
 * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/directory/[(path)/]`
 * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/content/(path)/`
 * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/content/(path)/`
 * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/log/`
 * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/log/`
 
 Typing:
 
 - *origin_type* corresponds to the type of the archived origin:
   *git*, *svn*, *hg*, *deposit*, *deb*, ...
 
 - *origin_url* corresponds to the URL the origin was crawled from,
   for instance https://github.com/(user)/(repo)/
 
 - *branch* name is given as per the corresponding VCS (e.g., Git) as
   a query parameter to the requestes URL.
 
 - *timestamp* is given in a format as liberal as possible, to uphold the
   principle of least surprise. At the very minimum it is possible to
   enter timestamps as:
 
   - Unix epoch timestamp (see for instance the output of `date +%s`)
   - ISO 8601 timestamps (see for instance the output of `date -I`, `date -Is`)
   - YYYY[MM[DD[HH[MM[SS]]]]] ad-hoc format
   - YYYY[-MM[-DD[ HH:[MM:[SS:]]]]] ad-hoc format
 
 
 SWH Browse Urls
 ---------------
 
 .. include:: uri-scheme-browse-content.rst
 
 .. include:: uri-scheme-browse-directory.rst
 
 .. include:: uri-scheme-browse-identifiers.rst
 
 .. include:: uri-scheme-browse-origin.rst
 
 .. include:: uri-scheme-browse-person.rst
 
 .. include:: uri-scheme-browse-release.rst
 
 .. include:: uri-scheme-browse-revision.rst
+
+.. include:: uri-scheme-browse-snapshot.rst
diff --git a/swh/web/browse/urls.py b/swh/web/browse/urls.py
index 376f3fa2..0e7273ba 100644
--- a/swh/web/browse/urls.py
+++ b/swh/web/browse/urls.py
@@ -1,38 +1,39 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 from django.conf.urls import url
 from django.shortcuts import render
 
 import swh.web.browse.views.directory # noqa
 import swh.web.browse.views.content # noqa
 import swh.web.browse.views.identifiers # noqa
 import swh.web.browse.views.origin # noqa
 import swh.web.browse.views.person # noqa
 import swh.web.browse.views.release # noqa
 import swh.web.browse.views.revision # noqa
+import swh.web.browse.views.snapshot # noqa
 
 from swh.web.browse.browseurls import BrowseUrls
 
 
 def default_browse_view(request):
     """Default django view used as an entry point
     for the swh browse ui web application.
 
     The url that point to it is /browse/.
 
     Args:
         request: input django http request
     """
     return render(request, 'person.html',
                   {'heading': 'Browse the Software Heritage archive',
                    'empty_browse': True})
 
 
 urlpatterns = [
     url(r'^$', default_browse_view, name='browse-homepage')
 ]
 
 urlpatterns += BrowseUrls.get_url_patterns()
diff --git a/swh/web/browse/utils.py b/swh/web/browse/utils.py
index 88bb2bca..c20eb770 100644
--- a/swh/web/browse/utils.py
+++ b/swh/web/browse/utils.py
@@ -1,842 +1,919 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 import base64
 import magic
 import math
 import stat
 
 from django.core.cache import cache
 from django.utils.safestring import mark_safe
 
 from importlib import reload
 
 from swh.web.common import highlightjs, service
 from swh.web.common.exc import NotFoundExc
 from swh.web.common.utils import (
     reverse, format_utc_iso_date, parse_timestamp
 )
 from swh.web.config import get_config
 
 
 def get_directory_entries(sha1_git):
     """Function that retrieves the content of a SWH directory
     from the SWH archive.
 
     The directories entries are first sorted in lexicographical order.
     Sub-directories and regular files are then extracted.
 
     Args:
         sha1_git: sha1_git identifier of the directory
 
     Returns:
         A tuple whose first member corresponds to the sub-directories list
         and second member the regular files list
 
     Raises:
         NotFoundExc if the directory is not found
     """
     cache_entry_id = 'directory_entries_%s' % sha1_git
     cache_entry = cache.get(cache_entry_id)
 
     if cache_entry:
         return cache_entry
 
     entries = list(service.lookup_directory(sha1_git))
     entries = sorted(entries, key=lambda e: e['name'])
     for entry in entries:
         entry['perms'] = stat.filemode(entry['perms'])
     dirs = [e for e in entries if e['type'] == 'dir']
     files = [e for e in entries if e['type'] == 'file']
 
     cache.set(cache_entry_id, (dirs, files))
 
     return dirs, files
 
 
 def get_mimetype_and_encoding_for_content(content):
     """Function that returns the mime type and the encoding associated to
     a content buffer using the magic module under the hood.
 
     Args:
         content (bytes): a content buffer
 
     Returns:
         A tuple (mimetype, encoding), for instance ('text/plain', 'us-ascii'),
         associated to the provided content.
 
     """
     while True:
         try:
             magic_result = magic.detect_from_content(content)
             mime_type = magic_result.mime_type
             encoding = magic_result.encoding
             break
         except Exception as exc:
             # workaround an issue with the magic module who can fail
             # if detect_from_content is called multiple times in
             # a short amount of time
             reload(magic)
 
     return mime_type, encoding
 
 
 # maximum authorized content size in bytes for HTML display
 # with code highlighting
 content_display_max_size = get_config()['content_display_max_size']
 
 
 def request_content(query_string, max_size=content_display_max_size):
     """Function that retrieves a SWH content from the SWH archive.
 
     Raw bytes content is first retrieved, then the content mime type.
     If the mime type is not stored in the archive, it will be computed
     using Python magic module.
 
     Args:
         query_string: a string of the form "[ALGO_HASH:]HASH" where
             optional ALGO_HASH can be either *sha1*, *sha1_git*, *sha256*,
             or *blake2s256* (default to *sha1*) and HASH the hexadecimal
             representation of the hash value
         max_size: the maximum size for a content to retrieve (default to 1MB,
             no size limit if None)
 
     Returns:
         A tuple whose first member corresponds to the content raw bytes
         and second member the content mime type
 
     Raises:
         NotFoundExc if the content is not found
     """
     content_data = service.lookup_content(query_string)
     filetype = service.lookup_content_filetype(query_string)
     language = service.lookup_content_language(query_string)
     license = service.lookup_content_license(query_string)
     mimetype = 'unknown'
     encoding = 'unknown'
     if filetype:
         mimetype = filetype['mimetype']
         encoding = filetype['encoding']
 
     if not max_size or content_data['length'] < max_size:
         content_raw = service.lookup_content_raw(query_string)
         content_data['raw_data'] = content_raw['data']
 
         if not filetype:
             mimetype, encoding = \
                 get_mimetype_and_encoding_for_content(content_data['raw_data'])
 
         # encode textual content to utf-8 if needed
         if mimetype.startswith('text/'):
             # probably a malformed UTF-8 content, reencode it
             # by replacing invalid chars with a substitution one
             if encoding == 'unknown-8bit':
                 content_data['raw_data'] = \
                     content_data['raw_data'].decode('utf-8', 'replace')\
                                             .encode('utf-8')
             elif 'ascii' not in encoding and encoding not in ['utf-8', 'binary']: # noqa
                 content_data['raw_data'] = \
                     content_data['raw_data'].decode(encoding, 'replace')\
                                             .encode('utf-8')
     else:
         content_data['raw_data'] = None
 
     content_data['mimetype'] = mimetype
     content_data['encoding'] = encoding
 
     if language:
         content_data['language'] = language['lang']
     else:
         content_data['language'] = 'not detected'
     if license:
         content_data['licenses'] = ', '.join(license['licenses'])
     else:
         content_data['licenses'] = 'not detected'
 
     return content_data
 
 
 _browsers_supported_image_mimes = set(['image/gif', 'image/png',
                                        'image/jpeg', 'image/bmp',
                                        'image/webp'])
 
 
 def prepare_content_for_display(content_data, mime_type, path):
     """Function that prepares a content for HTML display.
 
     The function tries to associate a programming language to a
     content in order to perform syntax highlighting client-side
     using highlightjs. The language is determined using either
     the content filename or its mime type.
     If the mime type corresponds to an image format supported
     by web browsers, the content will be encoded in base64
     for displaying the image.
 
     Args:
         content_data (bytes): raw bytes of the content
         mime_type (string): mime type of the content
         path (string): path of the content including filename
 
     Returns:
         A dict containing the content bytes (possibly different from the one
         provided as parameter if it is an image) under the key 'content_data
         and the corresponding highlightjs language class under the
         key 'language'.
     """
 
     language = highlightjs.get_hljs_language_from_filename(path)
 
     if not language:
         language = highlightjs.get_hljs_language_from_mime_type(mime_type)
 
     if not language:
         language = 'nohighlight-swh'
     elif mime_type.startswith('application/'):
         mime_type = mime_type.replace('application/', 'text/')
 
     if mime_type.startswith('image/'):
         if mime_type in _browsers_supported_image_mimes:
             content_data = base64.b64encode(content_data)
         else:
             content_data = None
 
     return {'content_data': content_data,
             'language': language}
 
 
 def get_origin_visits(origin_info):
     """Function that returns the list of visits for a swh origin.
     That list is put in cache in order to speedup the navigation
     in the swh web browse ui.
 
     Args:
         origin_id (int): the id of the swh origin to fetch visits from
 
     Returns:
         A list of dict describing the origin visits::
 
             [{'date': <UTC visit date in ISO format>,
               'origin': <origin id>,
               'status': <'full' | 'partial'>,
               'visit': <visit id>
              },
              ...
             ]
 
     Raises:
         NotFoundExc if the origin is not found
     """
     cache_entry_id = 'origin_%s_visits' % origin_info['id']
     cache_entry = cache.get(cache_entry_id)
 
     if cache_entry:
         return cache_entry
 
     origin_visits = []
 
     per_page = service.MAX_LIMIT
     last_visit = None
     while 1:
         visits = list(service.lookup_origin_visits(origin_info['id'],
                                                    last_visit=last_visit,
                                                    per_page=per_page))
         origin_visits += visits
         if len(visits) < per_page:
             break
         else:
             if not last_visit:
                 last_visit = per_page
             else:
                 last_visit += per_page
 
     def _visit_sort_key(visit):
         ts = parse_timestamp(visit['date']).timestamp()
         return ts + (float(visit['visit']) / 10e3)
 
     for v in origin_visits:
         if 'metadata' in v:
             del v['metadata']
     origin_visits = [dict(t) for t in set([tuple(d.items())
                                            for d in origin_visits])]
     origin_visits = sorted(origin_visits, key=lambda v: _visit_sort_key(v))
 
     cache.set(cache_entry_id, origin_visits)
 
     return origin_visits
 
 
 def get_origin_visit(origin_info, visit_ts=None, visit_id=None):
     """Function that returns information about a SWH visit for
     a given origin.
     The visit is retrieved from a provided timestamp.
     The closest visit from that timestamp is selected.
 
     Args:
         origin_info (dict): a dict filled with origin information
             (id, url, type)
         visit_ts (int or str): an ISO date string or Unix timestamp to parse
 
     Returns:
         A dict containing the visit info as described below::
 
             {'origin': 2,
              'date': '2017-10-08T11:54:25.582463+00:00',
              'metadata': {},
              'visit': 25,
              'status': 'full'}
 
     """
     visits = get_origin_visits(origin_info)
 
     if not visits:
         raise NotFoundExc('No SWH visit associated to origin with'
                           ' type %s and url %s!' % (origin_info['type'],
                                                     origin_info['url']))
 
     if visit_id:
         visit = [v for v in visits if v['visit'] == int(visit_id)]
         if len(visit) == 0:
             raise NotFoundExc(
                 'Visit with id %s for origin with type %s'
                 ' and url %s not found!' % (visit_id, origin_info['type'],
                                             origin_info['url']))
         return visit[0]
 
     if not visit_ts:
         # returns the latest full visit when no timestamp is provided
         for v in reversed(visits):
             if v['status'] == 'full':
                 return v
         return visits[-1]
 
     parsed_visit_ts = math.floor(parse_timestamp(visit_ts).timestamp())
 
     visit_idx = None
     for i, visit in enumerate(visits):
         ts = math.floor(parse_timestamp(visit['date']).timestamp())
         if i == 0 and parsed_visit_ts <= ts:
             return visit
         elif i == len(visits) - 1:
             if parsed_visit_ts >= ts:
                 return visit
         else:
             next_ts = math.floor(
                 parse_timestamp(visits[i+1]['date']).timestamp())
             if parsed_visit_ts >= ts and parsed_visit_ts < next_ts:
                 if (parsed_visit_ts - ts) < (next_ts - parsed_visit_ts):
                     visit_idx = i
                     break
                 else:
                     visit_idx = i+1
                     break
 
     if visit_idx:
         visit = visits[visit_idx]
         while visit_idx < len(visits) - 1 and \
                 visit['date'] == visits[visit_idx+1]['date']:
             visit_idx = visit_idx + 1
             visit = visits[visit_idx]
         return visit
     else:
         raise NotFoundExc(
             'Visit with timestamp %s for origin with type %s and url %s not found!' % # noqa
             (visit_ts, origin_info['type'], origin_info['url']))
 
 
-def get_origin_visit_snapshot(origin_info, visit_ts=None, visit_id=None):
-    """Function that returns the lists of branches and releases
-    associated to a swh origin for a given visit.
-    The visit is expressed by a timestamp. In the latter case,
-    the closest visit from the provided timestamp will be used.
-    If no visit parameter is provided, it returns the list of branches
-    found for the latest visit.
+def get_snapshot_content(snapshot_id):
+    """Returns the lists of branches and releases
+    associated to a swh snapshot.
     That list is put in  cache in order to speedup the navigation
-    in the swh web browse ui.
+    in the swh-web/browse ui.
 
     Args:
-        origin_info (dict): a dict filled with origin information
-            (id, url, type)
-        visit_ts (int or str): an ISO date string or Unix timestamp to parse
-        visit_id (int): optional visit id for desambiguation in case
-            several visits have the same timestamp
+        snapshot_id (str): hexadecimal representation of the snapshot
+            identifier
 
     Returns:
         A tuple with two members. The first one is a list of dict describing
-        the origin branches for the given visit::
-
-            [{'name': <branch name>,
-              'revision': <sha1_git of the associated revision>,
-              'directory': <sha1_git of the associated root directory>
-             },
-             ...
-            ]
-
-        The second one is a list of dict describing the origin branches
-        for the given visit.
+        the snapshot branches. The second one is a list of dict describing the
+        snapshot releases.
 
     Raises:
-        NotFoundExc if the origin or its visit are not found
+        NotFoundExc if the snapshot does not exist
     """
-
-    visit_info = get_origin_visit(origin_info, visit_ts, visit_id)
-
-    visit = visit_info['visit']
-
-    cache_entry_id = 'origin_%s_visit_%s_snapshot' % (origin_info['id'],
-                                                      visit)
+    cache_entry_id = 'swh_snapshot_%s' % snapshot_id
     cache_entry = cache.get(cache_entry_id)
 
     if cache_entry:
         return cache_entry['branches'], cache_entry['releases']
 
     branches = []
     releases = []
 
-    if visit_info['snapshot']:
+    if snapshot_id:
         revision_ids = []
         releases_ids = []
-        origin_visit_snapshot = service.lookup_snapshot(visit_info['snapshot'])
-        snapshot_branches = origin_visit_snapshot['branches']
+        snapshot = service.lookup_snapshot(snapshot_id)
+        snapshot_branches = snapshot['branches']
         for key in sorted(snapshot_branches.keys()):
             if not snapshot_branches[key]:
                 continue
             if snapshot_branches[key]['target_type'] == 'revision':
                 branches.append({'name': key,
-                                'revision': snapshot_branches[key]['target']})
+                                 'revision': snapshot_branches[key]['target']})
                 revision_ids.append(snapshot_branches[key]['target'])
             elif snapshot_branches[key]['target_type'] == 'release':
                 releases_ids.append(snapshot_branches[key]['target'])
 
         releases_info = service.lookup_release_multiple(releases_ids)
         for release in releases_info:
             releases.append({'name': release['name'],
                              'date': format_utc_iso_date(release['date']),
                              'id': release['id'],
                              'message': release['message'],
                              'target_type': release['target_type'],
                              'target': release['target']})
             revision_ids.append(release['target'])
 
         revisions = service.lookup_revision_multiple(revision_ids)
 
         branches_to_remove = []
 
         for idx, revision in enumerate(revisions):
             if idx < len(branches):
                 if revision:
                     branches[idx]['directory'] = revision['directory']
                     branches[idx]['date'] = format_utc_iso_date(revision['date']) # noqa
                     branches[idx]['message'] = revision['message']
                 else:
                     branches_to_remove.append(branches[idx])
             else:
                 rel_idx = idx - len(branches)
                 if revision:
                     releases[rel_idx]['directory'] = revision['directory']
 
         for b in branches_to_remove:
             branches.remove(b)
 
     cache.set(cache_entry_id, {'branches': branches, 'releases': releases})
 
     return branches, releases
 
 
+def get_origin_visit_snapshot(origin_info, visit_ts=None, visit_id=None):
+    """Returns the lists of branches and releases
+    associated to a swh origin for a given visit.
+    The visit is expressed by a timestamp. In the latter case,
+    the closest visit from the provided timestamp will be used.
+    If no visit parameter is provided, it returns the list of branches
+    found for the latest visit.
+    That list is put in  cache in order to speedup the navigation
+    in the swh-web/browse ui.
+
+    Args:
+        origin_info (dict): a dict filled with origin information
+            (id, url, type)
+        visit_ts (int or str): an ISO date string or Unix timestamp to parse
+        visit_id (int): optional visit id for desambiguation in case
+            several visits have the same timestamp
+
+    Returns:
+        A tuple with two members. The first one is a list of dict describing
+        the origin branches for the given visit.
+        The second one is a list of dict describing the origin releases
+        for the given visit.
+
+    Raises:
+        NotFoundExc if the origin or its visit are not found
+    """
+
+    visit_info = get_origin_visit(origin_info, visit_ts, visit_id)
+
+    return get_snapshot_content(visit_info['snapshot'])
+
+
 def gen_link(url, link_text, link_attrs={}):
     """
     Utility function for generating an HTML link to insert
     in Django templates.
 
     Args:
         url (str): an url
         link_text (str): the text for the produced link
         link_attrs (dict): optional attributes (e.g. class)
             to add to the link
 
     Returns:
         An HTML link in the form '<a href="url">link_text</a>'
 
     """
     attrs = ' '
     for k, v in link_attrs.items():
         attrs += '%s="%s" ' % (k, v)
     link = '<a%shref="%s">%s</a>' % (attrs, url, link_text)
     return mark_safe(link)
 
 
 def gen_person_link(person_id, person_name, link_attrs={}):
     """
     Utility function for generating a link to a SWH person HTML view
     to insert in Django templates.
 
     Args:
         person_id (int): a SWH person id
         person_name (str): the associated person name
         link_attrs (dict): optional attributes (e.g. class)
             to add to the link
 
     Returns:
         An HTML link in the form '<a href="person_view_url">person_name</a>'
 
     """
     person_url = reverse('browse-person', kwargs={'person_id': person_id})
     return gen_link(person_url, person_name, link_attrs)
 
 
-def gen_revision_link(revision_id, shorten_id=False, origin_context=None,
+def gen_revision_link(revision_id, shorten_id=False, snapshot_context=None,
                       link_text=None, link_attrs={}):
     """
     Utility function for generating a link to a SWH revision HTML view
     to insert in Django templates.
 
     Args:
         revision_id (str): a SWH revision id
         shorten_id (boolean): wheter to shorten the revision id to 7
             characters for the link text
-        origin_context (dict): if provided, generate origin-dependent browsing
-            link (see :func:`swh.web.browse.utils.get_origin_context`)
+        snapshot_context (dict): if provided, generate snapshot-dependent
+            browsing link
         link_attrs (dict): optional attributes (e.g. class)
             to add to the link
 
     Returns:
         An HTML link in the form '<a href="revision_view_url">revision_id</a>'
 
     """
     query_params = None
-    if origin_context:
-        origin_info = origin_context['origin_info']
+    if snapshot_context and snapshot_context['origin_info']:
+        origin_info = snapshot_context['origin_info']
         query_params = {'origin_type': origin_info['type'],
                         'origin_url': origin_info['url']}
-        if 'timestamp' in origin_context['url_args']:
+        if 'timestamp' in snapshot_context['url_args']:
             query_params['timestamp'] = \
-                 origin_context['url_args']['timestamp']
-        if 'visit_id' in origin_context['query_params']:
+                 snapshot_context['url_args']['timestamp']
+        if 'visit_id' in snapshot_context['query_params']:
             query_params['visit_id'] = \
-                origin_context['query_params']['visit_id']
+                snapshot_context['query_params']['visit_id']
+    elif snapshot_context:
+        query_params = {'snapshot_id': snapshot_context['snapshot_id']}
 
     revision_url = reverse('browse-revision',
                            kwargs={'sha1_git': revision_id},
                            query_params=query_params)
     if shorten_id:
         return gen_link(revision_url, revision_id[:7], link_attrs)
     else:
         if not link_text:
             link_text = revision_id
         return gen_link(revision_url, link_text, link_attrs)
 
 
 def gen_origin_link(origin_info, link_attrs={}):
     """
     Utility function for generating a link to a SWH origin HTML view
     to insert in Django templates.
 
     Args:
         origin_info (dict): a dicted filled with origin information
             (id, type, url)
         link_attrs (dict): optional attributes (e.g. class)
             to add to the link
 
     Returns:
         An HTML link in the form '<a href="origin_view_url">Origin: origin_url</a>'
 
     """ # noqa
     origin_browse_url = reverse('browse-origin',
                                 kwargs={'origin_type': origin_info['type'],
                                         'origin_url': origin_info['url']})
     return gen_link(origin_browse_url,
                     'Origin: ' + origin_info['url'], link_attrs)
 
 
 def gen_directory_link(sha1_git, link_text=None, link_attrs={}):
     """
     Utility function for generating a link to a SWH directory HTML view
     to insert in Django templates.
 
     Args:
         sha1_git (str): directory identifier
         link_text (str): optional text for the generated link
             (the generated url will be used by default)
         link_attrs (dict): optional attributes (e.g. class)
             to add to the link
 
     Returns:
         An HTML link in the form '<a href="directory_view_url">link_text</a>'
 
     """
     directory_url = reverse('browse-directory',
                             kwargs={'sha1_git': sha1_git})
     if not link_text:
         link_text = directory_url
     return gen_link(directory_url, link_text, link_attrs)
 
 
-def gen_origin_directory_link(origin_context, revision_id=None,
-                              link_text=None, link_attrs={}):
+def gen_snapshot_link(snapshot_id, link_text=None, link_attrs={}):
+    """
+    Utility function for generating a link to a SWH snapshot HTML view
+    to insert in Django templates.
+
+    Args:
+        snapshot_id (str): snapshot identifier
+        link_text (str): optional text for the generated link
+            (the generated url will be used by default)
+        link_attrs (dict): optional attributes (e.g. class)
+            to add to the link
+
+    Returns:
+        An HTML link in the form '<a href="snapshot_view_url">link_text</a>'
+
+    """
+    snapshot_url = reverse('browse-snapshot',
+                           kwargs={'snapshot_id': snapshot_id})
+    if not link_text:
+        link_text = snapshot_url
+    return gen_link(snapshot_url, link_text, link_attrs)
+
+
+def gen_snapshot_directory_link(snapshot_context, revision_id=None,
+                                link_text=None, link_attrs={}):
     """
     Utility function for generating a link to a SWH directory HTML view
-    in the context of an origin to insert in Django templates.
+    in the context of a snapshot to insert in Django templates.
 
     Args:
-        origin_info (dict): the origin information (type and url)
+        snapshot_context (dict): the snapshot information
         revision_id (str): optional revision identifier in order
             to use the associated directory
         link_text (str): optional text to use for the generated link
         link_attrs (dict): optional attributes (e.g. class)
             to add to the link
 
     Returns:
         An HTML link in the form
         '<a href="origin_directory_view_url">origin_directory_view_url</a>'
     """
-    origin_info = origin_context['origin_info']
-    url_args = {'origin_type': origin_info['type'],
-                'origin_url': origin_info['url']}
     query_params = {'revision': revision_id}
-    if 'timestamp' in origin_context['url_args']:
-        url_args['timestamp'] = \
-            origin_context['url_args']['timestamp']
-    if 'visit_id' in origin_context['query_params']:
-        query_params['visit_id'] = \
-            origin_context['query_params']['visit_id']
-    directory_url = reverse('browse-origin-directory',
-                            kwargs=url_args,
-                            query_params=query_params)
+    if snapshot_context['origin_info']:
+        origin_info = snapshot_context['origin_info']
+        url_args = {'origin_type': origin_info['type'],
+                    'origin_url': origin_info['url']}
+        if 'timestamp' in snapshot_context['url_args']:
+            url_args['timestamp'] = \
+                snapshot_context['url_args']['timestamp']
+        if 'visit_id' in snapshot_context['query_params']:
+            query_params['visit_id'] = \
+                snapshot_context['query_params']['visit_id']
+        directory_url = reverse('browse-origin-directory',
+                                kwargs=url_args,
+                                query_params=query_params)
+    else:
+        url_args = {'snapshot_id': snapshot_context['snapshot_id']}
+        directory_url = reverse('browse-snapshot-directory',
+                                kwargs=url_args,
+                                query_params=query_params)
+
     if not link_text:
         link_text = directory_url
     return gen_link(directory_url, link_text, link_attrs)
 
 
 def gen_content_link(sha1_git, link_text=None, link_attrs={}):
     """
     Utility function for generating a link to a SWH content HTML view
     to insert in Django templates.
 
     Args:
         sha1_git (str): content identifier
         link_text (str): optional text for the generated link
             (the generated url will be used by default)
         link_attrs (dict): optional attributes (e.g. class)
             to add to the link
 
     Returns:
         An HTML link in the form '<a href="content_view_url">link_text</a>'
 
     """
     content_url = reverse('browse-content',
                           kwargs={'query_string': 'sha1_git:' + sha1_git})
     if not link_text:
         link_text = content_url
     return gen_link(content_url, link_text, link_attrs)
 
 
-def get_revision_log_url(revision_id, origin_context=None):
+def get_revision_log_url(revision_id, snapshot_context=None):
     """
     Utility function for getting the URL for a SWH revision log HTML view
     (possibly in the context of an origin).
 
     Args:
         revision_id (str): revision identifier the history heads to
-        origin_context (dict): if provided, generate origin-dependent browsing
-            link (see :func:`swh.web.browse.utils.get_origin_context`)
+        snapshot_context (dict): if provided, generate snapshot-dependent
+            browsing link
     Returns:
         The SWH revision log view URL
     """
-    if origin_context:
-        origin_info = origin_context['origin_info']
+    query_params = {'revision': revision_id}
+    if snapshot_context and snapshot_context['origin_info']:
+        origin_info = snapshot_context['origin_info']
         url_args = {'origin_type': origin_info['type'],
                     'origin_url': origin_info['url']}
-        query_params = {'revision': revision_id}
-        if 'timestamp' in origin_context['url_args']:
+        if 'timestamp' in snapshot_context['url_args']:
             url_args['timestamp'] = \
-                origin_context['url_args']['timestamp']
-        if 'visit_id' in origin_context['query_params']:
+                snapshot_context['url_args']['timestamp']
+        if 'visit_id' in snapshot_context['query_params']:
             query_params['visit_id'] = \
-                origin_context['query_params']['visit_id']
+                snapshot_context['query_params']['visit_id']
         revision_log_url = reverse('browse-origin-log',
                                    kwargs=url_args,
                                    query_params=query_params)
+    elif snapshot_context:
+        url_args = {'snapshot_id': snapshot_context['snapshot_id']}
+        revision_log_url = reverse('browse-snapshot-log',
+                                   kwargs=url_args,
+                                   query_params=query_params)
     else:
         revision_log_url = reverse('browse-revision-log',
                                    kwargs={'sha1_git': revision_id})
     return revision_log_url
 
 
-def gen_revision_log_link(revision_id, origin_context=None, link_text=None,
+def gen_revision_log_link(revision_id, snapshot_context=None, link_text=None,
                           link_attrs={}):
     """
     Utility function for generating a link to a SWH revision log HTML view
     (possibly in the context of an origin) to insert in Django templates.
 
     Args:
         revision_id (str): revision identifier the history heads to
-        origin_context (dict): if provided, generate origin-dependent browsing
-            link (see :func:`swh.web.browse.utils.get_origin_context`)
+        snapshot_context (dict): if provided, generate snapshot-dependent
+            browsing link
         link_text (str): optional text to use for the generated link
         link_attrs (dict): optional attributes (e.g. class)
             to add to the link
 
     Returns:
         An HTML link in the form
         '<a href="revision_log_view_url">link_text</a>'
     """
 
-    revision_log_url = get_revision_log_url(revision_id, origin_context)
+    revision_log_url = get_revision_log_url(revision_id, snapshot_context)
     if not link_text:
         link_text = revision_log_url
     return gen_link(revision_log_url, link_text, link_attrs)
 
 
-def _format_log_entries(revision_log, per_page, origin_context=None):
+def _format_log_entries(revision_log, per_page, snapshot_context=None):
     revision_log_data = []
     for i, log in enumerate(revision_log):
         if i == per_page:
             break
         revision_log_data.append(
             {'author': gen_person_link(log['author']['id'],
                                        log['author']['name']),
-             'revision': gen_revision_link(log['id'], True, origin_context),
+             'revision': gen_revision_link(log['id'], True, snapshot_context),
              'message': log['message'],
              'date': format_utc_iso_date(log['date']),
              'directory': log['directory']})
     return revision_log_data
 
 
 def prepare_revision_log_for_display(revision_log, per_page, revs_breadcrumb,
-                                     origin_context=None):
+                                     snapshot_context=None):
     """
     Utility functions that process raw revision log data for HTML display.
     Its purpose is to:
 
         * add links to relevant SWH browse views
         * format date in human readable format
         * truncate the message log
 
     It also computes the data needed to generate the links for navigating back
     and forth in the history log.
 
     Args:
         revision_log (list): raw revision log as returned by the SWH web api
         per_page (int): number of log entries per page
         revs_breadcrumb (str): breadcrumbs of revisions navigated so far,
             in the form 'rev1[/rev2/../revN]'. Each revision corresponds to
             the first one displayed in the HTML view for history log.
-        origin_context (boolean): wheter or not the revision log is browsed
-            from an origin view.
+        snapshot_context (dict): if provided, generate snapshot-dependent
+            browsing link
 
 
     """
     current_rev = revision_log[0]['id']
     next_rev = None
     prev_rev = None
     next_revs_breadcrumb = None
     prev_revs_breadcrumb = None
     if len(revision_log) == per_page + 1:
         prev_rev = revision_log[-1]['id']
 
     prev_rev_bc = current_rev
-    if origin_context:
+    if snapshot_context:
         prev_rev_bc = prev_rev
 
     if revs_breadcrumb:
         revs = revs_breadcrumb.split('/')
         next_rev = revs[-1]
         if len(revs) > 1:
             next_revs_breadcrumb = '/'.join(revs[:-1])
         if len(revision_log) == per_page + 1:
             prev_revs_breadcrumb = revs_breadcrumb + '/' + prev_rev_bc
     else:
         prev_revs_breadcrumb = prev_rev_bc
 
     return {'revision_log_data': _format_log_entries(revision_log, per_page,
-                                                     origin_context),
+                                                     snapshot_context),
             'prev_rev': prev_rev,
             'prev_revs_breadcrumb': prev_revs_breadcrumb,
             'next_rev': next_rev,
             'next_revs_breadcrumb': next_revs_breadcrumb}
 
 
-def get_origin_context(origin_type, origin_url, timestamp, visit_id=None):
+def get_snapshot_context(snapshot_id=None, origin_type=None, origin_url=None,
+                         timestamp=None, visit_id=None):
     """
     Utility function to compute relevant information when navigating
-    the SWH archive in an origin context.
+    the SWH archive in a snapshot context. The snapshot is either
+    referenced by its id or it will be retrieved from an origin visit.
 
     Args:
+        snapshot_id (str): hexadecimal representation of a snapshot identifier,
+            all other parameters will be ignored if it is provided
         origin_type (str): the origin type (git, svn, deposit, ...)
-        origin_url (str): the origin_url (e.g. https://github.com/<user>/<repo>)
+        origin_url (str): the origin_url (e.g. https://github.com/(user)/(repo)/)
         timestamp (str): a datetime string for retrieving the closest
             SWH visit of the origin
         visit_id (int): optional visit id for disambiguation in case
             of several visits with the same timestamp
 
     Returns:
         A dict with the following entries:
             * origin_info: dict containing origin information
             * visit_info: dict containing SWH visit information
             * branches: the list of branches for the origin found
               during the visit
             * releases: the list of releases for the origin found
               during the visit
             * origin_browse_url: the url to browse the origin
             * origin_branches_url: the url to browse the origin branches
             * origin_releases_url': the url to browse the origin releases
             * origin_visit_url: the url to browse the snapshot of the origin
               found during the visit
             * url_args: dict containg url arguments to use when browsing in
               the context of the origin and its visit
     """ # noqa
-    origin_info = service.lookup_origin({'type': origin_type,
-                                         'url': origin_url})
-
-    visit_info = get_origin_visit(origin_info, timestamp, visit_id)
-    visit_info['fmt_date'] = format_utc_iso_date(visit_info['date'])
-
-    # provided timestamp is not necessarily equals to the one
-    # of the retrieved visit, so get the exact one in order
-    # use it in the urls generated below
-    if timestamp:
-        timestamp = visit_info['date']
-
-    branches, releases = \
-        get_origin_visit_snapshot(origin_info, timestamp, visit_id)
+    origin_info = None
+    visit_info = None
+    url_args = None
+    query_params = {}
+    branches = []
+    releases = []
+    browse_url = None
+    visit_url = None
+    branches_url = None
+    releases_url = None
+    swh_type = 'snapshot'
+    if origin_type and origin_url:
+        swh_type = 'origin'
+        origin_info = service.lookup_origin({'type': origin_type,
+                                            'url': origin_url})
+
+        visit_info = get_origin_visit(origin_info, timestamp, visit_id)
+        visit_info['fmt_date'] = format_utc_iso_date(visit_info['date'])
+        snapshot_id = visit_info['snapshot']
+
+        # provided timestamp is not necessarily equals to the one
+        # of the retrieved visit, so get the exact one in order
+        # use it in the urls generated below
+        if timestamp:
+            timestamp = visit_info['date']
+
+        branches, releases = \
+            get_origin_visit_snapshot(origin_info, timestamp, visit_id)
 
-    releases = list(reversed(releases))
+        url_args = {'origin_type': origin_info['type'],
+                    'origin_url': origin_info['url']}
 
-    url_args = {'origin_type': origin_info['type'],
-                'origin_url': origin_info['url']}
+        query_params = {'visit_id': visit_id}
 
-    if timestamp:
-        url_args['timestamp'] = format_utc_iso_date(timestamp,
-                                                    '%Y-%m-%dT%H:%M:%S')
+        browse_url = reverse('browse-origin',
+                             kwargs=url_args)
 
-    origin_browse_url = reverse('browse-origin',
-                                kwargs={'origin_type': origin_info['type'],
-                                        'origin_url': origin_info['url']})
+        if timestamp:
+            url_args['timestamp'] = format_utc_iso_date(timestamp,
+                                                        '%Y-%m-%dT%H:%M:%S')
+        visit_url = reverse('browse-origin-directory',
+                            kwargs=url_args,
+                            query_params=query_params)
+        visit_info['url'] = visit_url
 
-    origin_visit_url = reverse('browse-origin-directory',
+        branches_url = reverse('browse-origin-branches',
                                kwargs=url_args,
-                               query_params={'visit_id': visit_id})
+                               query_params=query_params)
 
-    origin_branches_url = reverse('browse-origin-branches',
-                                  kwargs=url_args,
-                                  query_params={'visit_id': visit_id})
+        releases_url = reverse('browse-origin-releases',
+                               kwargs=url_args,
+                               query_params=query_params)
+    elif snapshot_id:
+        branches, releases = get_snapshot_content(snapshot_id)
+        url_args = {'snapshot_id': snapshot_id}
+        browse_url = reverse('browse-snapshot',
+                             kwargs=url_args)
+        branches_url = reverse('browse-snapshot-branches',
+                               kwargs=url_args)
+
+        releases_url = reverse('browse-snapshot-releases',
+                               kwargs=url_args)
 
-    origin_releases_url = reverse('browse-origin-releases',
-                                  kwargs=url_args,
-                                  query_params={'visit_id': visit_id})
+    releases = list(reversed(releases))
 
     return {
+        'swh_type': swh_type,
+        'snapshot_id': snapshot_id,
         'origin_info': origin_info,
         'visit_info': visit_info,
         'branches': branches,
         'releases': releases,
         'branch': None,
         'release': None,
-        'origin_browse_url': origin_browse_url,
-        'origin_branches_url': origin_branches_url,
-        'origin_releases_url': origin_releases_url,
-        'origin_visit_url': origin_visit_url,
+        'browse_url': browse_url,
+        'branches_url': branches_url,
+        'releases_url': releases_url,
         'url_args': url_args,
-        'query_params': {'visit_id': visit_id}
+        'query_params': query_params
     }
diff --git a/swh/web/browse/views/content.py b/swh/web/browse/views/content.py
index de00d609..93508263 100644
--- a/swh/web/browse/views/content.py
+++ b/swh/web/browse/views/content.py
@@ -1,244 +1,244 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 import difflib
 import json
 
 from distutils.util import strtobool
 
 from django.http import HttpResponse
 from django.utils.safestring import mark_safe
 from django.shortcuts import render
 from django.template.defaultfilters import filesizeformat
 
 from swh.model.hashutil import hash_to_hex
 
 from swh.web.common import query
 from swh.web.common.utils import reverse, gen_path_info
 from swh.web.common.exc import handle_view_exception
 from swh.web.browse.utils import (
     request_content, prepare_content_for_display,
     content_display_max_size
 )
 from swh.web.browse.browseurls import browse_route
 
 
 @browse_route(r'content/(?P<query_string>.+)/raw/',
               view_name='browse-content-raw')
 def content_raw(request, query_string):
     """Django view that produces a raw display of a SWH content identified
     by its hash value.
 
     The url that points to it is :http:get:`/browse/content/[(algo_hash):](hash)/raw/`
     """ # noqa
 
     try:
         algo, checksum = query.parse_hash(query_string)
         checksum = hash_to_hex(checksum)
         content_data = request_content(query_string, max_size=None)
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     filename = request.GET.get('filename', None)
     if not filename:
         filename = '%s_%s' % (algo, checksum)
 
     if content_data['mimetype'].startswith('text/') or \
        content_data['mimetype'] == 'inode/x-empty':
         response = HttpResponse(content_data['raw_data'],
                                 content_type="text/plain")
         response['Content-disposition'] = 'filename=%s' % filename
     else:
         response = HttpResponse(content_data['raw_data'],
                                 content_type='application/octet-stream')
         response['Content-disposition'] = 'attachment; filename=%s' % filename
     return response
 
 
 _auto_diff_size_limit = 20000
 
 
 @browse_route(r'content/(?P<from_query_string>.*)/diff/(?P<to_query_string>.*)', # noqa
               view_name='diff-contents')
 def _contents_diff(request, from_query_string, to_query_string):
     """
     Browse endpoint used to compute unified diffs between two contents.
 
     Diffs are generated only if the two contents are textual.
     By default, diffs whose size are greater than 20 kB will
     not be generated. To force the generation of large diffs,
     the 'force' boolean query parameter must be used.
 
     Args:
         request: input django http request
         from_query_string: a string of the form "[ALGO_HASH:]HASH" where
             optional ALGO_HASH can be either *sha1*, *sha1_git*, *sha256*,
             or *blake2s256* (default to *sha1*) and HASH the hexadecimal
             representation of the hash value identifying the first content
         to_query_string: same as above for identifying the second content
 
     Returns:
         A JSON object containing the unified diff.
 
     """
     diff_data = {}
     content_from = None
     content_to = None
     content_from_size = 0
     content_to_size = 0
     content_from_lines = []
     content_to_lines = []
     force = request.GET.get('force', 'false')
     path = request.GET.get('path', None)
     language = 'nohighlight-swh'
 
     force = bool(strtobool(force))
 
     if from_query_string == to_query_string:
         diff_str = 'File renamed without changes'
     else:
         text_diff = True
         if from_query_string:
             content_from = request_content(from_query_string, max_size=None)
             content_from_display_data = prepare_content_for_display(
                     content_from['raw_data'], content_from['mimetype'], path)
             language = content_from_display_data['language']
             content_from_size = content_from['length']
             if not (content_from['mimetype'].startswith('text/') or
                     content_from['mimetype'] == 'inode/x-empty'):
                 text_diff = False
 
         if text_diff and to_query_string:
             content_to = request_content(to_query_string, max_size=None)
             content_to_display_data = prepare_content_for_display(
                     content_to['raw_data'], content_to['mimetype'], path)
             language = content_to_display_data['language']
             content_to_size = content_to['length']
             if not (content_to['mimetype'].startswith('text/') or
                     content_to['mimetype'] == 'inode/x-empty'):
                 text_diff = False
 
         diff_size = abs(content_to_size - content_from_size)
 
         if not text_diff:
             diff_str = 'Diffs are not generated for non textual content'
             language = 'nohighlight-swh'
         elif not force and diff_size > _auto_diff_size_limit:
             diff_str = 'Large diffs are not automatically computed'
             language = 'nohighlight-swh'
         else:
             if content_from:
                 content_from_lines = content_from['raw_data'].decode('utf-8')\
                                                              .splitlines(True)
                 if content_from_lines and content_from_lines[-1][-1] != '\n':
                     content_from_lines[-1] += '[swh-no-nl-marker]\n'
 
             if content_to:
                 content_to_lines = content_to['raw_data'].decode('utf-8')\
                                                          .splitlines(True)
                 if content_to_lines and content_to_lines[-1][-1] != '\n':
                     content_to_lines[-1] += '[swh-no-nl-marker]\n'
 
             diff_lines = difflib.unified_diff(content_from_lines,
                                               content_to_lines)
             diff_str = ''.join(list(diff_lines)[2:])
 
     diff_data['diff_str'] = diff_str
     diff_data['language'] = language
     diff_data_json = json.dumps(diff_data, separators=(',', ': '))
     return HttpResponse(diff_data_json, content_type='application/json')
 
 
 @browse_route(r'content/(?P<query_string>.+)/',
               view_name='browse-content')
 def content_display(request, query_string):
     """Django view that produces an HTML display of a SWH content identified
     by its hash value.
 
     The url that points to it is :http:get:`/browse/content/[(algo_hash):](hash)/`
     """ # noqa
     try:
         algo, checksum = query.parse_hash(query_string)
         checksum = hash_to_hex(checksum)
         content_data = request_content(query_string)
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     path = request.GET.get('path', None)
 
     content = None
     language = None
     if content_data['raw_data'] is not None:
         content_display_data = prepare_content_for_display(
             content_data['raw_data'], content_data['mimetype'], path)
         content = content_display_data['content_data']
         language = content_display_data['language']
 
     root_dir = None
     filename = None
     path_info = None
 
     breadcrumbs = []
 
     if path:
         split_path = path.split('/')
         root_dir = split_path[0]
         filename = split_path[-1]
         path = path.replace(root_dir + '/', '')
         path = path[:-len(filename)]
         path_info = gen_path_info(path)
         breadcrumbs.append({'name': root_dir[:7],
                             'url': reverse('browse-directory',
                                            kwargs={'sha1_git': root_dir})})
         for pi in path_info:
             breadcrumbs.append({'name': pi['name'],
                                 'url': reverse('browse-directory',
                                                kwargs={'sha1_git': root_dir,
                                                        'path': pi['path']})})
         breadcrumbs.append({'name': filename,
                             'url': None})
 
     query_params = None
     if filename:
         query_params = {'filename': filename}
 
     content_raw_url = reverse('browse-content-raw',
                               kwargs={'query_string': query_string},
                               query_params=query_params)
 
     content_metadata = {
         'sha1 checksum': content_data['checksums']['sha1'],
         'sha1_git checksum': content_data['checksums']['sha1_git'],
         'sha256 checksum': content_data['checksums']['sha256'],
         'blake2s256 checksum': content_data['checksums']['blake2s256'],
         'mime type': content_data['mimetype'],
         'encoding': content_data['encoding'],
         'size': filesizeformat(content_data['length']),
         'language': content_data['language'],
         'licenses': content_data['licenses']
     }
 
     return render(request, 'content.html',
                   {'empty_browse': False,
                    'heading': 'Content information',
                    'top_panel_visible': True,
                    'top_panel_collapsible': True,
                    'top_panel_text': 'SWH object: Content',
                    'swh_object_metadata': content_metadata,
                    'main_panel_visible': True,
                    'content': content,
                    'content_size': content_data['length'],
                    'max_content_size': content_display_max_size,
                    'mimetype': content_data['mimetype'],
                    'language': language,
                    'breadcrumbs': breadcrumbs,
                    'top_right_link': content_raw_url,
                    'top_right_link_text': mark_safe(
                        '<i class="fa fa-file-text fa-fw" aria-hidden="true">'
                        '</i>Raw File'),
-                   'origin_context': None,
+                   'snapshot_context': None,
                    'vault_cooking': None,
                    'show_actions_menu': False
                    })
diff --git a/swh/web/browse/views/directory.py b/swh/web/browse/views/directory.py
index 1753c96f..d9ee1472 100644
--- a/swh/web/browse/views/directory.py
+++ b/swh/web/browse/views/directory.py
@@ -1,106 +1,106 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 
 from django.shortcuts import render
 from django.template.defaultfilters import filesizeformat
 
 from swh.web.common import service
 from swh.web.common.utils import reverse, gen_path_info
 from swh.web.common.exc import handle_view_exception
 from swh.web.browse.utils import get_directory_entries
 
 from swh.web.browse.browseurls import browse_route
 
 
 @browse_route(r'directory/(?P<sha1_git>[0-9a-f]+)/',
               r'directory/(?P<sha1_git>[0-9a-f]+)/(?P<path>.+)/',
               view_name='browse-directory')
 def directory_browse(request, sha1_git, path=None):
     """Django view for browsing the content of a SWH directory identified
     by its sha1_git value.
 
     The url that points to it is :http:get:`/browse/directory/(sha1_git)/[(path)/]`
     """ # noqa
     root_sha1_git = sha1_git
     try:
         if path:
             dir_info = service.lookup_directory_with_path(sha1_git, path)
             sha1_git = dir_info['target']
 
         dirs, files = get_directory_entries(sha1_git)
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     path_info = gen_path_info(path)
 
     breadcrumbs = []
     breadcrumbs.append({'name': root_sha1_git[:7],
                         'url': reverse('browse-directory',
                                        kwargs={'sha1_git': root_sha1_git})})
     for pi in path_info:
         breadcrumbs.append({'name': pi['name'],
                             'url': reverse('browse-directory',
                                            kwargs={'sha1_git': root_sha1_git,
                                                    'path': pi['path']})})
 
     path = '' if path is None else (path + '/')
 
     for d in dirs:
         d['url'] = reverse('browse-directory',
                            kwargs={'sha1_git': root_sha1_git,
                                    'path': path + d['name']})
 
     sum_file_sizes = 0
 
     readme_name = None
     readme_url = None
 
     for f in files:
         query_string = 'sha1_git:' + f['target']
         f['url'] = reverse('browse-content',
                            kwargs={'query_string': query_string},
                            query_params={'path': root_sha1_git + '/' +
                                          path + f['name']})
         sum_file_sizes += f['length']
         f['length'] = filesizeformat(f['length'])
         if f['name'].lower().startswith('readme'):
             readme_name = f['name']
             readme_sha1 = f['checksums']['sha1']
             readme_url = reverse('browse-content-raw',
                                  kwargs={'query_string': readme_sha1})
 
     sum_file_sizes = filesizeformat(sum_file_sizes)
 
     dir_metadata = {'id': sha1_git,
                     'number of regular files': len(files),
                     'number of subdirectories': len(dirs),
                     'sum of regular file sizes': sum_file_sizes}
 
     vault_cooking = {
         'directory_context': True,
         'directory_id': sha1_git,
         'revision_context': False,
         'revision_id': None
     }
 
     return render(request, 'directory.html',
                   {'empty_browse': False,
                    'heading': 'Directory information',
                    'top_panel_visible': True,
                    'top_panel_collapsible': True,
                    'top_panel_text': 'SWH object: Directory',
                    'swh_object_metadata': dir_metadata,
                    'main_panel_visible': True,
                    'dirs': dirs,
                    'files': files,
                    'breadcrumbs': breadcrumbs,
                    'top_right_link': None,
                    'top_right_link_text': None,
                    'readme_name': readme_name,
                    'readme_url': readme_url,
-                   'origin_context': None,
+                   'snapshot_context': None,
                    'vault_cooking': vault_cooking,
                    'show_actions_menu': True})
diff --git a/swh/web/browse/views/identifiers.py b/swh/web/browse/views/identifiers.py
index 8ff74ca1..31f3a08c 100644
--- a/swh/web/browse/views/identifiers.py
+++ b/swh/web/browse/views/identifiers.py
@@ -1,52 +1,56 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 from django.shortcuts import redirect
 
 from swh.model.identifiers import parse_persistent_identifier
 
 from swh.web.browse.browseurls import browse_route
 from swh.web.common.utils import reverse
 from swh.web.common.exc import BadInputExc, handle_view_exception
 
 
 @browse_route(r'(?P<swh_id>swh:[0-9]+:[a-z]+:[0-9a-f]+)/',
               view_name='browse-swh-id')
 def swh_id_browse(request, swh_id):
     """
     Django view enabling to browse the SWH archive using
     :ref:`persistent-identifiers`.
 
     The url that points to it is :http:get:`/browse/(swh_id)/`.
     """
     try:
         swh_id_parsed = parse_persistent_identifier(swh_id)
         object_type = swh_id_parsed['object_type']
         object_id = swh_id_parsed['object_id']
         view_url = None
         if object_type == 'cnt':
             query_string = 'sha1_git:' + object_id
             view_url = reverse('browse-content',
                                kwargs={'query_string': query_string},
                                query_params=request.GET)
         elif object_type == 'dir':
             view_url = reverse('browse-directory',
                                kwargs={'sha1_git': object_id},
                                query_params=request.GET)
         elif object_type == 'rel':
             view_url = reverse('browse-release',
                                kwargs={'sha1_git': object_id},
                                query_params=request.GET)
         elif object_type == 'rev':
             view_url = reverse('browse-revision',
                                kwargs={'sha1_git': object_id},
                                query_params=request.GET)
+        elif object_type == 'snp':
+            view_url = reverse('browse-snapshot',
+                               kwargs={'snapshot_id': object_id},
+                               query_params=request.GET)
         else:
             msg = '\'%s\' is not a valid SWH persistent identifier!' % swh_id
             raise BadInputExc(msg)
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     return redirect(view_url)
diff --git a/swh/web/browse/views/origin.py b/swh/web/browse/views/origin.py
index d1f6297f..c5fb9fad 100644
--- a/swh/web/browse/views/origin.py
+++ b/swh/web/browse/views/origin.py
@@ -1,829 +1,224 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 import json
 
 from distutils.util import strtobool
 
 from django.http import HttpResponse
 from django.shortcuts import render
-from django.utils.safestring import mark_safe
-from django.template.defaultfilters import filesizeformat
 
 from swh.web.common import service
 from swh.web.common.utils import (
-    gen_path_info, reverse, format_utc_iso_date,
-    parse_timestamp
-)
-from swh.web.common.exc import NotFoundExc, handle_view_exception
-from swh.web.browse.utils import (
-    get_origin_visits,
-    get_directory_entries, request_content,
-    prepare_content_for_display,
-    prepare_revision_log_for_display,
-    get_origin_context, gen_directory_link,
-    gen_revision_link, gen_revision_log_link,
-    gen_content_link, gen_origin_directory_link,
-    content_display_max_size
+    reverse, format_utc_iso_date, parse_timestamp
 )
+from swh.web.common.exc import handle_view_exception
+from swh.web.browse.utils import get_origin_visits
 from swh.web.browse.browseurls import browse_route
 
-
-def _branch_not_found(origin_info, timestamp,
-                      branch_type, branch, branches,
-                      visit_id=None):
-    """
-    Utility function to raise an exception when a specified branch/release
-    can not be found.
-    """
-    if branch_type:
-        occ_type = 'Branch'
-        occ_type_plural = 'branches'
-    else:
-        occ_type = 'Release'
-        occ_type_plural = 'releases'
-
-    if visit_id:
-        if len(branches) == 0:
-            raise NotFoundExc('Origin with type %s and url %s'
-                              ' for visit with id %s has an empty list'
-                              ' of %s!' % (origin_info['type'],
-                                           origin_info['url'], visit_id,
-                                           occ_type_plural))
-        else:
-            raise NotFoundExc('%s %s associated to visit with'
-                              ' id %s for origin with type %s and url %s'
-                              ' not found!' % (occ_type, branch, visit_id,
-                                               origin_info['type'],
-                                               origin_info['url']))
-    else:
-        if len(branches) == 0:
-            raise NotFoundExc('Origin with type %s and url %s'
-                              ' for visit with timestamp %s has an empty list'
-                              ' of %s!' % (origin_info['type'],
-                                           origin_info['url'],
-                                           timestamp, occ_type_plural))
-        else:
-            raise NotFoundExc('%s %s associated to visit with'
-                              ' timestamp %s for origin with type %s'
-                              ' and url %s not found!' % (occ_type, branch,
-                                                          timestamp,
-                                                          origin_info['type'],
-                                                          origin_info['url']))
-
-
-def _get_branch(branches, branch_name):
-    """
-    Utility function to get a specific branch from an origin branches list.
-    Its purpose is to get the default HEAD branch as some SWH origin
-    (e.g those with svn type) does not have it. In that latter case, check
-    if there is a master branch instead and returns it.
-    """
-    filtered_branches = \
-        [b for b in branches if b['name'].endswith(branch_name)]
-    if len(filtered_branches) > 0:
-        return filtered_branches[0]
-    elif branch_name == 'HEAD':
-        filtered_branches = \
-            [b for b in branches if b['name'].endswith('master')]
-        if len(filtered_branches) > 0:
-            return filtered_branches[0]
-        elif len(branches) > 0:
-            return branches[0]
-    return None
-
-
-def _get_release(releases, release_name):
-    filtered_releases = \
-        [r for r in releases if r['name'] == release_name]
-    if len(filtered_releases) > 0:
-        return filtered_releases[0]
-    else:
-        return None
-
-
-def _process_origin_request(request, origin_type, origin_url,
-                            timestamp, path, browse_view_name):
-    """
-    Utility function to perform common input request processing
-    for origin context views.
-    """
-
-    visit_id = request.GET.get('visit_id', None)
-
-    origin_context = get_origin_context(origin_type, origin_url,
-                                        timestamp, visit_id)
-
-    for b in origin_context['branches']:
-        branch_url_args = dict(origin_context['url_args'])
-        if path:
-            b['path'] = path
-            branch_url_args['path'] = path
-        b['url'] = reverse(browse_view_name,
-                           kwargs=branch_url_args,
-                           query_params={'branch': b['name'],
-                                         'visit_id': visit_id})
-
-    for r in origin_context['releases']:
-        release_url_args = dict(origin_context['url_args'])
-        if path:
-            r['path'] = path
-            release_url_args['path'] = path
-        r['url'] = reverse(browse_view_name,
-                           kwargs=release_url_args,
-                           query_params={'release': r['name'],
-                                         'visit_id': visit_id})
-
-    root_sha1_git = None
-    query_params = origin_context['query_params']
-    revision_id = request.GET.get('revision', None)
-    release_name = request.GET.get('release', None)
-    branch_name = None
-
-    if revision_id:
-        revision = service.lookup_revision(revision_id)
-        root_sha1_git = revision['directory']
-        origin_context['branches'].append({'name': revision_id,
-                                           'revision': revision_id,
-                                           'directory': root_sha1_git,
-                                           'url': None})
-        branch_name = revision_id
-        query_params['revision'] = revision_id
-    elif release_name:
-        release = _get_release(origin_context['releases'], release_name)
-        if release:
-            root_sha1_git = release['directory']
-            query_params['release'] = release_name
-            revision_id = release['target']
-        else:
-            _branch_not_found(origin_context['origin_info'], timestamp,
-                              False, release_name,
-                              origin_context['releases'], visit_id)
-    else:
-        branch_name = request.GET.get('branch', None)
-        if branch_name:
-            query_params['branch'] = branch_name
-        branch = _get_branch(origin_context['branches'], branch_name or 'HEAD')
-        if branch:
-            branch_name = branch['name']
-            root_sha1_git = branch['directory']
-            revision_id = branch['revision']
-
-        else:
-            _branch_not_found(origin_context['origin_info'], timestamp,
-                              True, branch_name,
-                              origin_context['branches'], visit_id)
-
-    origin_context['root_sha1_git'] = root_sha1_git
-    origin_context['revision_id'] = revision_id
-    origin_context['branch'] = branch_name
-    origin_context['release'] = release_name
-
-    return origin_context
-
+from .utils.snapshot_context import (
+    browse_snapshot_directory, browse_snapshot_content,
+    browse_snapshot_log, browse_snapshot_branches,
+    browse_snapshot_releases
+)
 
 @browse_route(r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/directory/', # noqa
               r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/directory/(?P<path>.+)/', # noqa
               r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/directory/', # noqa
               r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/directory/(?P<path>.+)/', # noqa
               view_name='browse-origin-directory')
 def origin_directory_browse(request, origin_type, origin_url,
                             timestamp=None, path=None):
     """Django view for browsing the content of a SWH directory associated
     to an origin for a given visit.
 
     The url scheme that points to it is the following:
 
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/directory/[(path)/]`
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/directory/[(path)/]`
     """ # noqa
-    try:
-
-        origin_context = _process_origin_request(
-            request, origin_type, origin_url, timestamp, path,
-            'browse-origin-directory')
-
-        root_sha1_git = origin_context['root_sha1_git']
-        sha1_git = root_sha1_git
-        if path:
-            dir_info = service.lookup_directory_with_path(root_sha1_git, path)
-            sha1_git = dir_info['target']
-
-        dirs, files = get_directory_entries(sha1_git)
-
-    except Exception as exc:
-        return handle_view_exception(request, exc)
-
-    origin_info = origin_context['origin_info']
-    visit_info = origin_context['visit_info']
-    url_args = origin_context['url_args']
-    query_params = origin_context['query_params']
-    revision_id = origin_context['revision_id']
-
-    path_info = gen_path_info(path)
-
-    breadcrumbs = []
-    breadcrumbs.append({'name': root_sha1_git[:7],
-                        'url': reverse('browse-origin-directory',
-                                       kwargs=url_args,
-                                       query_params=query_params)})
-    for pi in path_info:
-        bc_url_args = dict(url_args)
-        bc_url_args['path'] = pi['path']
-        breadcrumbs.append({'name': pi['name'],
-                            'url': reverse('browse-origin-directory',
-                                           kwargs=bc_url_args,
-                                           query_params=query_params)})
-
-    path = '' if path is None else (path + '/')
-
-    for d in dirs:
-        bc_url_args = dict(url_args)
-        bc_url_args['path'] = path + d['name']
-        d['url'] = reverse('browse-origin-directory',
-                           kwargs=bc_url_args,
-                           query_params=query_params)
-
-    sum_file_sizes = 0
-
-    readme_name = None
-    readme_url = None
-
-    for f in files:
-        bc_url_args = dict(url_args)
-        bc_url_args['path'] = path + f['name']
-        f['url'] = reverse('browse-origin-content',
-                           kwargs=bc_url_args,
-                           query_params=query_params)
-        sum_file_sizes += f['length']
-        f['length'] = filesizeformat(f['length'])
-        if f['name'].lower().startswith('readme'):
-            readme_name = f['name']
-            readme_sha1 = f['checksums']['sha1']
-            readme_url = reverse('browse-content-raw',
-                                 kwargs={'query_string': readme_sha1})
-
-    history_url = reverse('browse-origin-log',
-                          kwargs=url_args,
-                          query_params=query_params)
-
-    sum_file_sizes = filesizeformat(sum_file_sizes)
-
-    browse_dir_link = \
-        gen_directory_link(sha1_git, link_text='Browse',
-                           link_attrs={'class': 'btn btn-md btn-swh',
-                                       'role': 'button'})
-
-    browse_rev_link = \
-        gen_revision_link(revision_id,
-                          origin_context=origin_context,
-                          link_text='Browse',
-                          link_attrs={'class': 'btn btn-md btn-swh',
-                                      'role': 'button'})
-
-    dir_metadata = {'id': sha1_git,
-                    'context-independent directory': browse_dir_link,
-                    'number of regular files': len(files),
-                    'number of subdirectories': len(dirs),
-                    'sum of regular file sizes': sum_file_sizes,
-                    'origin id': origin_info['id'],
-                    'origin type': origin_info['type'],
-                    'origin url': origin_info['url'],
-                    'origin visit date': format_utc_iso_date(visit_info['date']), # noqa
-                    'origin visit id': visit_info['visit'],
-                    'path': '/' + path,
-                    'revision id': revision_id,
-                    'revision': browse_rev_link}
-
-    vault_cooking = {
-        'directory_context': True,
-        'directory_id': sha1_git,
-        'revision_context': True,
-        'revision_id': revision_id
-    }
-
-    return render(request, 'directory.html',
-                  {'empty_browse': False,
-                   'heading': 'Directory information',
-                   'top_panel_visible': True,
-                   'top_panel_collapsible': True,
-                   'top_panel_text': 'SWH object: Directory',
-                   'swh_object_metadata': dir_metadata,
-                   'main_panel_visible': True,
-                   'dirs': dirs,
-                   'files': files,
-                   'breadcrumbs': breadcrumbs,
-                   'top_right_link': history_url,
-                   'top_right_link_text': mark_safe(
-                       '<i class="fa fa-history fa-fw" aria-hidden="true"></i>'
-                       'History'
-                    ),
-                   'readme_name': readme_name,
-                   'readme_url': readme_url,
-                   'origin_context': origin_context,
-                   'vault_cooking': vault_cooking,
-                   'show_actions_menu': True})
+    return browse_snapshot_directory(
+        request, origin_type=origin_type, origin_url=origin_url,
+        timestamp=timestamp, path=path)
 
 
 @browse_route(r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/content/(?P<path>.+)/', # noqa
               r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/content/(?P<path>.+)/', # noqa
               view_name='browse-origin-content')
-def origin_content_display(request, origin_type, origin_url, path,
-                           timestamp=None):
+def origin_content_browse(request, origin_type, origin_url, path,
+                          timestamp=None):
     """Django view that produces an HTML display of a SWH content
     associated to an origin for a given visit.
 
     The url scheme that points to it is the following:
 
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/content/(path)/`
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/content/(path)/`
 
     """ # noqa
-    try:
-
-        origin_context = _process_origin_request(
-            request, origin_type, origin_url, timestamp, path,
-            'browse-origin-content')
-
-        root_sha1_git = origin_context['root_sha1_git']
-        content_info = service.lookup_directory_with_path(root_sha1_git, path)
-        sha1_git = content_info['target']
-        query_string = 'sha1_git:' + sha1_git
-        content_data = request_content(query_string)
-
-    except Exception as exc:
-        return handle_view_exception(request, exc)
-
-    url_args = origin_context['url_args']
-    query_params = origin_context['query_params']
-    revision_id = origin_context['revision_id']
-    origin_info = origin_context['origin_info']
-    visit_info = origin_context['visit_info']
-
-    content = None
-    language = None
-    if content_data['raw_data'] is not None:
-        content_display_data = prepare_content_for_display(
-            content_data['raw_data'], content_data['mimetype'], path)
-        content = content_display_data['content_data']
-        language = content_display_data['language']
-
-    filename = None
-    path_info = None
-
-    breadcrumbs = []
-
-    split_path = path.split('/')
-    filename = split_path[-1]
-    path = path[:-len(filename)]
-    path_info = gen_path_info(path)
-    breadcrumbs.append({'name': root_sha1_git[:7],
-                        'url': reverse('browse-origin-directory',
-                                       kwargs=url_args,
-                                       query_params=query_params)})
-    for pi in path_info:
-        bc_url_args = dict(url_args)
-        bc_url_args['path'] = pi['path']
-        breadcrumbs.append({'name': pi['name'],
-                            'url': reverse('browse-origin-directory',
-                                           kwargs=bc_url_args,
-                                           query_params=query_params)})
-
-    breadcrumbs.append({'name': filename,
-                        'url': None})
-
-    browse_content_link = \
-        gen_content_link(sha1_git, link_text='Browse',
-                         link_attrs={'class': 'btn btn-md btn-swh',
-                                     'role': 'button'})
-
-    content_raw_url = reverse('browse-content-raw',
-                              kwargs={'query_string': query_string},
-                              query_params={'filename': filename})
-
-    browse_rev_link = \
-        gen_revision_link(revision_id,
-                          origin_context=origin_context,
-                          link_text='Browse',
-                          link_attrs={'class': 'btn btn-md btn-swh',
-                                      'role': 'button'})
-
-    content_metadata = {
-        'context-independent content': browse_content_link,
-        'sha1 checksum': content_data['checksums']['sha1'],
-        'sha1_git checksum': content_data['checksums']['sha1_git'],
-        'sha256 checksum': content_data['checksums']['sha256'],
-        'blake2s256 checksum': content_data['checksums']['blake2s256'],
-        'mime type': content_data['mimetype'],
-        'encoding': content_data['encoding'],
-        'size': filesizeformat(content_data['length']),
-        'language': content_data['language'],
-        'licenses': content_data['licenses'],
-        'origin id': origin_info['id'],
-        'origin type': origin_info['type'],
-        'origin url': origin_info['url'],
-        'origin visit date': format_utc_iso_date(visit_info['date']),
-        'origin visit id': visit_info['visit'],
-        'path': '/' + path,
-        'filename': filename,
-        'revision id': revision_id,
-        'revision': browse_rev_link
-    }
-
-    return render(request, 'content.html',
-                  {'empty_browse': False,
-                   'heading': 'Content information',
-                   'top_panel_visible': True,
-                   'top_panel_collapsible': True,
-                   'top_panel_text': 'SWH object: Content',
-                   'swh_object_metadata': content_metadata,
-                   'main_panel_visible': True,
-                   'content': content,
-                   'content_size': content_data['length'],
-                   'max_content_size': content_display_max_size,
-                   'mimetype': content_data['mimetype'],
-                   'language': language,
-                   'breadcrumbs': breadcrumbs,
-                   'top_right_link': content_raw_url,
-                   'top_right_link_text': mark_safe(
-                       '<i class="fa fa-file-text fa-fw" aria-hidden="true">'
-                       '</i>Raw File'),
-                   'origin_context': origin_context,
-                   'vault_cooking': None,
-                   'show_actions_menu': False})
+    return browse_snapshot_content(request, origin_type=origin_type,
+                                   origin_url=origin_url, timestamp=timestamp,
+                                   path=path)
 
 
 PER_PAGE = 20
 
 
 @browse_route(r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/log/', # noqa
               r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/log/',
               view_name='browse-origin-log')
 def origin_log_browse(request, origin_type, origin_url, timestamp=None):
     """Django view that produces an HTML display of revisions history (aka
     the commit log) associated to a SWH origin.
 
     The url scheme that points to it is the following:
 
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/log/`
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/log/`
     """ # noqa
-    try:
-
-        origin_context = _process_origin_request(
-            request, origin_type, origin_url, timestamp, None,
-            'browse-origin-log')
-
-        revision_id = origin_context['revision_id']
-        current_rev = revision_id
-        per_page = int(request.GET.get('per_page', PER_PAGE))
-        revs_breadcrumb = request.GET.get('revs_breadcrumb', None)
-
-        if revs_breadcrumb:
-            current_rev = revs_breadcrumb.split('/')[-1]
-        revision_log = service.lookup_revision_log(current_rev,
-                                                   limit=per_page+1)
-        revision_log = list(revision_log)
-
-    except Exception as exc:
-        return handle_view_exception(request, exc)
-
-    origin_info = origin_context['origin_info']
-    visit_info = origin_context['visit_info']
-    url_args = origin_context['url_args']
-    query_params = origin_context['query_params']
-
-    query_params['per_page'] = per_page
-
-    revision_log_display_data = prepare_revision_log_for_display(
-        revision_log, per_page, revs_breadcrumb, origin_context)
-
-    prev_rev = revision_log_display_data['prev_rev']
-    prev_revs_breadcrumb = revision_log_display_data['prev_revs_breadcrumb']
-    prev_log_url = None
-    query_params['revs_breadcrumb'] = prev_revs_breadcrumb
-    if prev_rev:
-        prev_log_url = \
-            reverse('browse-origin-log',
-                    kwargs=url_args,
-                    query_params=query_params)
-
-    next_rev = revision_log_display_data['next_rev']
-    next_revs_breadcrumb = revision_log_display_data['next_revs_breadcrumb']
-    next_log_url = None
-    query_params['revs_breadcrumb'] = next_revs_breadcrumb
-    if next_rev:
-        next_log_url = \
-            reverse('browse-origin-log',
-                    kwargs=url_args,
-                    query_params=query_params)
-
-    revision_log_data = revision_log_display_data['revision_log_data']
-
-    for i, log in enumerate(revision_log_data):
-        params = {
-            'revision': revision_log[i]['id'],
-        }
-        if 'visit_id' in query_params:
-            params['visit_id'] = query_params['visit_id']
-        log['directory'] = gen_origin_directory_link(
-            origin_context, revision_log[i]['id'],
-            link_text='<i class="fa fa-folder-open fa-fw" aria-hidden="true">'
-                      '</i>Browse files',
-            link_attrs={'class': 'btn btn-md btn-swh',
-                        'role': 'button'})
-
-    browse_log_link = \
-        gen_revision_log_link(revision_id, link_text='Browse',
-                              link_attrs={'class': 'btn btn-md btn-swh',
-                                          'role': 'button'})
-
-    revision_metadata = {
-        'context-independent revision history': browse_log_link,
-        'origin id': origin_info['id'],
-        'origin type': origin_info['type'],
-        'origin url': origin_info['url'],
-        'origin visit date': format_utc_iso_date(visit_info['date']),
-        'origin visit id': visit_info['visit']
-    }
-
-    return render(request, 'revision-log.html',
-                  {'empty_browse': False,
-                   'heading': 'Revision history information',
-                   'top_panel_visible': True,
-                   'top_panel_collapsible': True,
-                   'top_panel_text': 'SWH object: Revision history',
-                   'swh_object_metadata': revision_metadata,
-                   'main_panel_visible': True,
-                   'revision_log': revision_log_data,
-                   'next_log_url': next_log_url,
-                   'prev_log_url': prev_log_url,
-                   'breadcrumbs': None,
-                   'top_right_link': None,
-                   'top_right_link_text': None,
-                   'origin_context': origin_context,
-                   'vault_cooking': None,
-                   'show_actions_menu': False})
-
+    return browse_snapshot_log(request, origin_type=origin_type,
+                               origin_url=origin_url, timestamp=timestamp)
 
 @browse_route(r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/branches/', # noqa
               r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/branches/', # noqa
               view_name='browse-origin-branches')
 def origin_branches_browse(request, origin_type, origin_url, timestamp=None):
     """Django view that produces an HTML display of the list of branches
     associated to an origin for a given visit.
 
     The url scheme that points to it is the following:
 
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/branches/`
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/branches/`
 
     """ # noqa
-    try:
-        origin_context = _process_origin_request(
-            request, origin_type, origin_url, timestamp, None,
-            'browse-origin-directory')
-
-    except Exception as exc:
-        return handle_view_exception(request, exc)
-
-    branches_offset = int(request.GET.get('branches_offset', 0))
-
-    origin_info = origin_context['origin_info']
-    url_args = origin_context['url_args']
-    query_params = origin_context['query_params']
-
-    branches = origin_context['branches']
-
-    displayed_branches = \
-        branches[branches_offset:branches_offset+PER_PAGE]
-
-    for branch in displayed_branches:
-        revision_url = reverse(
-            'browse-revision', kwargs={'sha1_git': branch['revision']},
-            query_params={'origin_type': origin_info['type'],
-                          'origin_url': origin_info['url']})
-        query_params['branch'] = branch['name']
-        directory_url = reverse('browse-origin-directory',
-                                kwargs=url_args,
-                                query_params=query_params)
-        del query_params['branch']
-        branch['revision_url'] = revision_url
-        branch['directory_url'] = directory_url
-
-    prev_branches_url = None
-    next_branches_url = None
-
-    next_offset = branches_offset + PER_PAGE
-    prev_offset = branches_offset - PER_PAGE
-    if next_offset < len(branches):
-        query_params['branches_offset'] = next_offset
-        next_branches_url = reverse('browse-origin-branches',
-                                    kwargs=url_args, query_params=query_params)
-    query_params['branches_offset'] = None
-    if prev_offset >= 0:
-        if prev_offset != 0:
-            query_params['branches_offset'] = prev_offset
-        prev_branches_url = reverse('browse-origin-branches',
-                                    kwargs=url_args, query_params=query_params)
-
-    return render(request, 'branches.html',
-                  {'empty_browse': False,
-                   'heading': 'Origin branches list',
-                   'top_panel_visible': False,
-                   'top_panel_collapsible': False,
-                   'top_panel_text': 'SWH object: Origin branches list',
-                   'swh_object_metadata': {},
-                   'main_panel_visible': True,
-                   'top_right_link': None,
-                   'top_right_link_text': None,
-                   'displayed_branches': displayed_branches,
-                   'prev_branches_url': prev_branches_url,
-                   'next_branches_url': next_branches_url,
-                   'origin_context': origin_context})
+    return browse_snapshot_branches(request, origin_type=origin_type,
+                                    origin_url=origin_url, timestamp=timestamp)
 
 
 @browse_route(r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/releases/', # noqa
               r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/releases/', # noqa
               view_name='browse-origin-releases')
 def origin_releases_browse(request, origin_type, origin_url, timestamp=None):
     """Django view that produces an HTML display of the list of releases
     associated to an origin for a given visit.
 
     The url scheme that points to it is the following:
 
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/releases/`
         * :http:get:`/browse/origin/(origin_type)/url/(origin_url)/visit/(timestamp)/releases/`
 
     """ # noqa
-    try:
-        origin_context = _process_origin_request(
-            request, origin_type, origin_url, timestamp, None,
-            'browse-origin-directory')
-
-    except Exception as exc:
-        return handle_view_exception(request, exc)
-
-    releases_offset = int(request.GET.get('releases_offset', 0))
-
-    origin_info = origin_context['origin_info']
-    url_args = origin_context['url_args']
-    query_params = origin_context['query_params']
-
-    releases = origin_context['releases']
-
-    displayed_releases = \
-        releases[releases_offset:releases_offset+PER_PAGE]
-
-    for release in displayed_releases:
-        release_url = reverse('browse-release',
-                              kwargs={'sha1_git': release['id']},
-                              query_params={'origin_type': origin_info['type'],
-                                            'origin_url': origin_info['url']})
-        query_params['release'] = release['name']
-        del query_params['release']
-        release['release_url'] = release_url
-
-    prev_releases_url = None
-    next_releases_url = None
-
-    next_offset = releases_offset + PER_PAGE
-    prev_offset = releases_offset - PER_PAGE
-    if next_offset < len(releases):
-        query_params['releases_offset'] = next_offset
-        next_releases_url = reverse('browse-origin-releases',
-                                    kwargs=url_args, query_params=query_params)
-    query_params['releases_offset'] = None
-    if prev_offset >= 0:
-        if prev_offset != 0:
-            query_params['releases_offset'] = prev_offset
-        prev_releases_url = reverse('browse-origin-releases',
-                                    kwargs=url_args, query_params=query_params)
-
-    return render(request, 'releases.html',
-                  {'empty_browse': False,
-                   'heading': 'Origin releases list',
-                   'top_panel_visible': False,
-                   'top_panel_collapsible': False,
-                   'top_panel_text': 'SWH object: Origin releases list',
-                   'swh_object_metadata': {},
-                   'main_panel_visible': True,
-                   'top_right_link': None,
-                   'top_right_link_text': None,
-                   'displayed_releases': displayed_releases,
-                   'prev_releases_url': prev_releases_url,
-                   'next_releases_url': next_releases_url,
-                   'origin_context': origin_context,
-                   'vault_cooking': None,
-                   'show_actions_menu': False})
+    return browse_snapshot_releases(request, origin_type=origin_type,
+                                    origin_url=origin_url, timestamp=timestamp)
 
 
 @browse_route(r'origin/(?P<origin_type>[a-z]+)/url/(?P<origin_url>.+)/',
               view_name='browse-origin')
 def origin_browse(request, origin_type=None, origin_url=None):
     """Django view that produces an HTML display of a swh origin identified
     by its id or its url.
 
-    The url scheme that points to it is :http:get:`/browse/origin/(origin_type)/url/(origin_url)/`.
+    The url that points to it is :http:get:`/browse/origin/(origin_type)/url/(origin_url)/`.
     """ # noqa
     try:
         origin_info = service.lookup_origin({
             'type': origin_type,
             'url': origin_url
         })
         origin_visits = get_origin_visits(origin_info)
         origin_visits.reverse()
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     origin_info['last swh visit browse url'] = \
         reverse('browse-origin-directory',
                 kwargs={'origin_type': origin_type,
                         'origin_url': origin_url})
 
     origin_visits_data = []
     visits_splitted = []
     visits_by_year = {}
     for i, visit in enumerate(origin_visits):
         visit_date = parse_timestamp(visit['date'])
         visit_year = str(visit_date.year)
         url_date = format_utc_iso_date(visit['date'], '%Y-%m-%dT%H:%M:%SZ')
         visit['fmt_date'] = format_utc_iso_date(visit['date'])
         query_params = {}
         if i < len(origin_visits) - 1:
             if visit['date'] == origin_visits[i+1]['date']:
                 query_params = {'visit_id': visit['visit']}
         if i > 0:
             if visit['date'] == origin_visits[i-1]['date']:
                 query_params = {'visit_id': visit['visit']}
 
         visit['browse_url'] = reverse('browse-origin-directory',
                                       kwargs={'origin_type': origin_type,
                                               'origin_url': origin_url,
                                               'timestamp': url_date},
                                       query_params=query_params)
         origin_visits_data.insert(0, {'date': visit_date.timestamp()})
         if visit_year not in visits_by_year:
             # display 3 years by row in visits list view
             if len(visits_by_year) == 3:
                 visits_splitted.append(visits_by_year)
                 visits_by_year = {}
             visits_by_year[visit_year] = []
         visits_by_year[visit_year].append(visit)
 
     if len(visits_by_year) > 0:
         visits_splitted.append(visits_by_year)
 
     return render(request, 'origin.html',
                   {'empty_browse': False,
                    'heading': 'Origin information',
                    'top_panel_visible': False,
                    'top_panel_collapsible': False,
                    'top_panel_text': 'SWH object: Visits history',
                    'swh_object_metadata': origin_info,
                    'main_panel_visible': True,
                    'origin_visits_data': origin_visits_data,
                    'visits_splitted': visits_splitted,
                    'origin_info': origin_info,
                    'browse_url_base': '/browse/origin/%s/url/%s/' %
                    (origin_type, origin_url),
                    'vault_cooking': None,
                    'show_actions_menu': False})
 
 
 @browse_route(r'origin/search/(?P<url_pattern>.+)/',
               view_name='browse-origin-search')
-def origin_search(request, url_pattern):
-    """Search for origins whose urls contain a provided string pattern
-    or match a provided regular expression.
+def _origin_search(request, url_pattern):
+    """Internal browse endpoint to search for origins whose urls contain
+    a provided string pattern or match a provided regular expression.
     The search is performed in a case insensitive way.
     """
     offset = int(request.GET.get('offset', '0'))
     limit = int(request.GET.get('limit', '50'))
     regexp = request.GET.get('regexp', 'false')
 
     results = service.search_origin(url_pattern, offset, limit,
                                     bool(strtobool(regexp)))
 
     results = json.dumps(list(results), sort_keys=True, indent=4,
                          separators=(',', ': '))
 
     return HttpResponse(results, content_type='application/json')
 
 
 @browse_route(r'origin/(?P<origin_id>[0-9]+)/latest_snapshot/',
               view_name='browse-origin-latest-snapshot')
 def _origin_latest_snapshot(request, origin_id):
     """
     Internal browse endpoint used to check if an origin has already
     been visited by Software Heritage and has at least one full visit.
     """
     result = service.lookup_latest_origin_snapshot(origin_id,
                                                    allowed_statuses=['full'])
 
     result = json.dumps(result, sort_keys=True, indent=4,
                         separators=(',', ': '))
 
     return HttpResponse(result, content_type='application/json')
diff --git a/swh/web/browse/views/release.py b/swh/web/browse/views/release.py
index a453c761..f85b3189 100644
--- a/swh/web/browse/views/release.py
+++ b/swh/web/browse/views/release.py
@@ -1,92 +1,94 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 from django.shortcuts import render
 from django.utils.safestring import mark_safe
 
 from swh.web.common import service
 from swh.web.common.utils import reverse, format_utc_iso_date
 from swh.web.common.exc import handle_view_exception
 from swh.web.browse.browseurls import browse_route
 from swh.web.browse.utils import (
     gen_person_link, gen_revision_link,
-    get_origin_context, gen_link
+    get_snapshot_context, gen_link
 )
 
 
 @browse_route(r'release/(?P<sha1_git>[0-9a-f]+)/',
               view_name='browse-release')
 def release_browse(request, sha1_git):
     """
     Django view that produces an HTML display of a SWH release
     identified by its id.
 
     The url that points to it is :http:get:`/browse/release/(sha1_git)/`.
     """
     try:
         release = service.lookup_release(sha1_git)
-        origin_context = None
+        snapshot_context = None
+        snapshot_id = request.GET.get('snapshot_id', None)
         origin_type = request.GET.get('origin_type', None)
         origin_url = request.GET.get('origin_url', None)
         timestamp = request.GET.get('timestamp', None)
         visit_id = request.GET.get('visit_id', None)
         if origin_type and origin_url:
-            origin_context = get_origin_context(origin_type, origin_url,
-                                                timestamp, visit_id)
+            snapshot_context = get_snapshot_context(snapshot_id, origin_type,
+                                                    origin_url, timestamp,
+                                                    visit_id)
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     release_data = {}
 
     release_data['author'] = gen_person_link(
         release['author']['id'], release['author']['name'])
     release_data['date'] = format_utc_iso_date(release['date'])
     release_data['id'] = sha1_git
     release_data['name'] = release['name']
     release_data['synthetic'] = release['synthetic']
     release_data['target type'] = release['target_type']
 
     if release['target_type'] == 'revision':
         release_data['target'] = \
             gen_revision_link(release['target'],
-                              origin_context=origin_context)
+                              snapshot_context=snapshot_context)
     elif release['target_type'] == 'content':
         content_url = \
             reverse('browse-content',
                     kwargs={'query_string': 'sha1_git:' + release['target']})
         release_data['target'] = gen_link(content_url, release['target'])
     elif release['target_type'] == 'directory':
         directory_url = \
             reverse('browse-directory',
                     kwargs={'sha1_git': release['target']})
         release_data['target'] = gen_link(directory_url, release['target'])
     elif release['target_type'] == 'release':
         release_url = \
             reverse('browse-release',
                     kwargs={'sha1_git': release['target']})
         release_data['target'] = gen_link(release_url, release['target'])
 
     release_note_lines = release['message'].split('\n')
 
     release_target_link = '<b>Target:</b> '
     if release['target_type'] == 'revision':
         release_target_link += '<i class="octicon octicon-git-commit fa-fw"></i>' # noqa
     else:
         release_target_link += release['target_type']
     release_target_link += ' ' + release_data['target']
 
     return render(request, 'release.html',
                   {'empty_browse': False,
                    'heading': 'Release information',
                    'top_panel_visible': True,
                    'top_panel_collapsible': True,
                    'top_panel_text': 'SWH object: Release',
                    'swh_object_metadata': release_data,
                    'main_panel_visible': True,
                    'release_name': release['name'],
                    'release_note_header': release_note_lines[0],
                    'release_note_body': '\n'.join(release_note_lines[1:]),
                    'release_target_link': mark_safe(release_target_link),
-                   'origin_context': origin_context})
+                   'snapshot_context': snapshot_context})
diff --git a/swh/web/browse/views/revision.py b/swh/web/browse/views/revision.py
index 0a12dcf0..58c56cd5 100644
--- a/swh/web/browse/views/revision.py
+++ b/swh/web/browse/views/revision.py
@@ -1,448 +1,462 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 import hashlib
 import json
 
 from django.http import HttpResponse
 from django.shortcuts import render
 from django.template.defaultfilters import filesizeformat
 from django.utils.safestring import mark_safe
 
 from swh.web.common import service
 from swh.web.common.utils import reverse, format_utc_iso_date, gen_path_info
 from swh.web.common.exc import handle_view_exception
 from swh.web.browse.browseurls import browse_route
 from swh.web.browse.utils import (
     gen_link, gen_person_link, gen_revision_link,
     prepare_revision_log_for_display,
-    get_origin_context, gen_origin_directory_link,
+    get_snapshot_context, gen_snapshot_directory_link,
     get_revision_log_url, get_directory_entries,
     gen_directory_link, request_content, prepare_content_for_display,
-    content_display_max_size
+    content_display_max_size, gen_snapshot_link
 )
 
 
-def _gen_content_url(revision, query_string, path, origin_context):
-    if origin_context:
-        url_args = origin_context['url_args']
+def _gen_content_url(revision, query_string, path, snapshot_context):
+    if snapshot_context:
+        url_args = snapshot_context['url_args']
         url_args['path'] = path
-        query_params = origin_context['query_params']
+        query_params = snapshot_context['query_params']
         query_params['revision'] = revision['id']
         content_url = reverse('browse-origin-content',
                               kwargs=url_args,
                               query_params=query_params)
     else:
         content_path = '%s/%s' % (revision['directory'], path)
         content_url = reverse('browse-content',
                               kwargs={'query_string': query_string},
                               query_params={'path': content_path})
     return content_url
 
 
 def _gen_diff_link(idx, diff_anchor, link_text):
     if idx < _max_displayed_file_diffs:
         return gen_link(diff_anchor, link_text)
     else:
         return link_text
 
 
 # TODO: put in conf
 _max_displayed_file_diffs = 1000
 
 
-def _gen_revision_changes_list(revision, changes, origin_context):
+def _gen_revision_changes_list(revision, changes, snapshot_context):
     """
     Returns a HTML string describing the file changes
     introduced in a revision.
     As this string will be displayed in the browse revision view,
     links to adequate file diffs are also generated.
 
     Args:
         revision (str): hexadecimal representation of a revision identifier
         changes (list): list of file changes in the revision
-        origin_context (dict): optional origin context used to reverse
+        snapshot_context (dict): optional origin context used to reverse
             the content urls
 
     Returns:
         A string to insert in a revision HTML view.
 
     """
     changes_msg = []
     for i, change in enumerate(changes):
         hasher = hashlib.sha1()
         from_query_string = ''
         to_query_string = ''
         diff_id = 'diff-'
         if change['from']:
             from_query_string = 'sha1_git:' + change['from']['target']
             diff_id += change['from']['target'] + '-' + change['from_path']
         diff_id += '-'
         if change['to']:
             to_query_string = 'sha1_git:' + change['to']['target']
             diff_id += change['to']['target'] + change['to_path']
         change['path'] = change['to_path'] or change['from_path']
         url_args = {'from_query_string': from_query_string,
                     'to_query_string': to_query_string}
         query_params = {'path': change['path']}
         change['diff_url'] = reverse('diff-contents',
                                      kwargs=url_args,
                                      query_params=query_params)
 
         hasher.update(diff_id.encode('utf-8'))
         diff_id = hasher.hexdigest()
         change['id'] = diff_id
         panel_diff_link = '#panel_' + diff_id
 
         if change['type'] == 'modify':
             change['content_url'] = \
                 _gen_content_url(revision, to_query_string,
-                                 change['to_path'], origin_context)
+                                 change['to_path'], snapshot_context)
             changes_msg.append('modified:  %s' %
                                _gen_diff_link(i, panel_diff_link,
                                               change['to_path']))
         elif change['type'] == 'insert':
             change['content_url'] = \
                 _gen_content_url(revision, to_query_string,
-                                 change['to_path'], origin_context)
+                                 change['to_path'], snapshot_context)
             changes_msg.append('new file:  %s' %
                                _gen_diff_link(i, panel_diff_link,
                                               change['to_path']))
         elif change['type'] == 'delete':
             parent = service.lookup_revision(revision['parents'][0])
             change['content_url'] = \
                 _gen_content_url(parent,
                                  from_query_string,
-                                 change['from_path'], origin_context)
+                                 change['from_path'], snapshot_context)
             changes_msg.append('deleted:   %s' %
                                _gen_diff_link(i, panel_diff_link,
                                               change['from_path']))
         elif change['type'] == 'rename':
             change['content_url'] = \
                 _gen_content_url(revision, to_query_string,
-                                 change['to_path'], origin_context)
+                                 change['to_path'], snapshot_context)
             link_text = change['from_path'] + ' &rarr; ' + change['to_path']
             changes_msg.append('renamed:   %s' %
                                _gen_diff_link(i, panel_diff_link, link_text))
     if not changes:
         changes_msg.append('No changes')
     return mark_safe('\n'.join(changes_msg))
 
 
 @browse_route(r'revision/(?P<sha1_git>[0-9a-f]+)/diff/',
               view_name='diff-revision')
 def _revision_diff(request, sha1_git):
     """
     Browse internal endpoint to compute revision diff
     """
     try:
         revision = service.lookup_revision(sha1_git)
-        origin_context = None
+        snapshot_context = None
         origin_type = request.GET.get('origin_type', None)
         origin_url = request.GET.get('origin_url', None)
         timestamp = request.GET.get('timestamp', None)
         visit_id = request.GET.get('visit_id', None)
         if origin_type and origin_url:
-            origin_context = get_origin_context(origin_type, origin_url,
-                                                timestamp, visit_id)
+            snapshot_context = get_snapshot_context(None, origin_type,
+                                                    origin_url,
+                                                    timestamp, visit_id)
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     changes = service.diff_revision(sha1_git)
-    changes_msg = _gen_revision_changes_list(revision, changes, origin_context)
+    changes_msg = _gen_revision_changes_list(revision, changes,
+                                             snapshot_context)
 
     diff_data = {
         'total_nb_changes': len(changes),
         'changes': changes[:_max_displayed_file_diffs],
         'changes_msg': changes_msg
     }
     diff_data_json = json.dumps(diff_data, separators=(',', ': '))
     return HttpResponse(diff_data_json, content_type='application/json')
 
 
 @browse_route(r'revision/(?P<sha1_git>[0-9a-f]+)/',
               view_name='browse-revision')
 def revision_browse(request, sha1_git):
     """
     Django view that produces an HTML display of a SWH revision
     identified by its id.
 
     The url that points to it is :http:get:`/browse/revision/(sha1_git)/`.
     """
     try:
         revision = service.lookup_revision(sha1_git)
         origin_info = None
-        origin_context = None
+        snapshot_context = None
         origin_type = request.GET.get('origin_type', None)
         origin_url = request.GET.get('origin_url', None)
         timestamp = request.GET.get('timestamp', None)
         visit_id = request.GET.get('visit_id', None)
+        snapshot_id = request.GET.get('snapshot_id', None)
         path = request.GET.get('path', None)
         dir_id = None
         dirs, files = None, None
         content_data = None
         if origin_type and origin_url:
-            origin_context = get_origin_context(origin_type, origin_url,
-                                                timestamp, visit_id)
-            origin_info = origin_context['origin_info']
+            snapshot_context = get_snapshot_context(None, origin_type,
+                                                    origin_url,
+                                                    timestamp, visit_id)
+            origin_info = snapshot_context['origin_info']
+            snapshot_id = snapshot_context['snapshot_id']
+        elif snapshot_id:
+            snapshot_context = get_snapshot_context(snapshot_id)
         if path:
             path_info = \
                 service.lookup_directory_with_path(revision['directory'], path)
             if path_info['type'] == 'dir':
                 dir_id = path_info['target']
             else:
                 query_string = 'sha1_git:' + path_info['target']
                 content_data = request_content(query_string)
         else:
             dir_id = revision['directory']
 
         if dir_id:
             path = '' if path is None else (path + '/')
             dirs, files = get_directory_entries(dir_id)
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     revision_data = {}
 
     revision_data['author'] = gen_person_link(
         revision['author']['id'], revision['author']['name'])
     revision_data['committer'] = gen_person_link(
         revision['committer']['id'], revision['committer']['name'])
     revision_data['committer date'] = format_utc_iso_date(
         revision['committer_date'])
     revision_data['date'] = format_utc_iso_date(revision['date'])
-    if origin_context:
+    if snapshot_context:
+        revision_data['snapshot id'] = snapshot_id
         revision_data['directory'] = \
-            gen_origin_directory_link(origin_context, sha1_git,
-                                      link_text='Browse',
-                                      link_attrs={'class': 'btn btn-md btn-swh', # noqa
-                                                  'role': 'button'})
+            gen_snapshot_directory_link(snapshot_context, sha1_git,
+                                        link_text='Browse',
+                                        link_attrs={'class': 'btn btn-md btn-swh', # noqa
+                                                    'role': 'button'})
     else:
         revision_data['directory'] = \
             gen_directory_link(revision['directory'], link_text='Browse',
                                link_attrs={'class': 'btn btn-md btn-swh',
                                            'role': 'button'})
     revision_data['id'] = sha1_git
     revision_data['merge'] = revision['merge']
     revision_data['metadata'] = json.dumps(revision['metadata'],
                                            sort_keys=True,
                                            indent=4, separators=(',', ': '))
 
     if origin_info:
         revision_data['context-independent revision'] = \
             gen_revision_link(sha1_git, link_text='Browse',
                               link_attrs={'class': 'btn btn-md btn-swh',
                                           'role': 'button'})
         revision_data['origin id'] = origin_info['id']
         revision_data['origin type'] = origin_info['type']
         revision_data['origin url'] = gen_link(origin_info['url'],
                                                origin_info['url'])
+        browse_snapshot_link = \
+            gen_snapshot_link(snapshot_id, link_text='Browse',
+                              link_attrs={'class': 'btn btn-md btn-swh',
+                                          'role': 'button'})
+        revision_data['snapshot'] = browse_snapshot_link
 
     parents = ''
     for p in revision['parents']:
-        parent_link = gen_revision_link(p, origin_context=origin_context)
+        parent_link = gen_revision_link(p, snapshot_context=snapshot_context)
         parents += parent_link + '<br/>'
 
     revision_data['parents'] = mark_safe(parents)
     revision_data['synthetic'] = revision['synthetic']
     revision_data['type'] = revision['type']
 
     message_lines = revision['message'].split('\n')
 
     parents_links = '<b>%s parent%s</b> ' %  \
         (len(revision['parents']),
          '' if len(revision['parents']) == 1 else 's')
     parents_links += '<i class="octicon octicon-git-commit fa-fw"></i> '
     for p in revision['parents']:
         parent_link = gen_revision_link(p, shorten_id=True,
-                                        origin_context=origin_context)
+                                        snapshot_context=snapshot_context)
         parents_links += parent_link
         if p != revision['parents'][-1]:
             parents_links += ' + '
 
     path_info = gen_path_info(path)
 
-    query_params = {'origin_type': origin_type,
+    query_params = {'snapshot_id': snapshot_id,
+                    'origin_type': origin_type,
                     'origin_url': origin_url,
                     'timestamp': timestamp,
                     'visit_id': visit_id}
 
     breadcrumbs = []
     breadcrumbs.append({'name': revision['directory'][:7],
                         'url': reverse('browse-revision',
                                        kwargs={'sha1_git': sha1_git},
                                        query_params=query_params)})
     for pi in path_info:
         query_params['path'] = pi['path']
         breadcrumbs.append({'name': pi['name'],
                             'url': reverse('browse-revision',
                                            kwargs={'sha1_git': sha1_git},
                                            query_params=query_params)})
 
     vault_cooking = {
         'directory_context': False,
         'directory_id': None,
         'revision_context': True,
         'revision_id': sha1_git
     }
 
     content = None
     content_size = None
     mimetype = None
     language = None
     readme_name = None
     readme_url = None
 
     if content_data:
         breadcrumbs[-1]['url'] = None
         content_size = content_data['length']
         mimetype = content_data['mimetype']
         if content_data['raw_data']:
             content_display_data = prepare_content_for_display(
                 content_data['raw_data'], content_data['mimetype'], path)
             content = content_display_data['content_data']
             language = content_display_data['language']
         query_params = {}
         if path:
             query_params['filename'] = path_info[-1]['name']
         top_right_link = reverse('browse-content-raw',
                                  kwargs={'query_string': query_string},
                                  query_params=query_params)
         top_right_link_text = mark_safe(
             '<i class="fa fa-file-text fa-fw" aria-hidden="true">'
             '</i>Raw File')
     else:
         for d in dirs:
             query_params['path'] = path + d['name']
             d['url'] = reverse('browse-revision',
                                kwargs={'sha1_git': sha1_git},
                                query_params=query_params)
         for f in files:
             query_params['path'] = path + f['name']
             f['url'] = reverse('browse-revision',
                                kwargs={'sha1_git': sha1_git},
                                query_params=query_params)
             f['length'] = filesizeformat(f['length'])
             if f['name'].lower().startswith('readme'):
                 readme_name = f['name']
                 readme_sha1 = f['checksums']['sha1']
                 readme_url = reverse('browse-content-raw',
                                      kwargs={'query_string': readme_sha1})
 
-        top_right_link = get_revision_log_url(sha1_git, origin_context)
+        top_right_link = get_revision_log_url(sha1_git, snapshot_context)
         top_right_link_text = mark_safe(
             '<i class="fa fa-history fa-fw" aria-hidden="true"></i>'
             'History')
 
         vault_cooking['directory_context'] = True
         vault_cooking['directory_id'] = dir_id
 
     diff_revision_url = reverse('diff-revision', kwargs={'sha1_git': sha1_git},
                                 query_params={'origin_type': origin_type,
                                               'origin_url': origin_url,
                                               'timestamp': timestamp,
                                               'visit_id': visit_id})
 
     return render(request, 'revision.html',
                   {'empty_browse': False,
                    'heading': 'Revision information',
                    'top_panel_visible': True,
                    'top_panel_collapsible': True,
                    'top_panel_text': 'SWH object: Revision',
                    'swh_object_metadata': revision_data,
                    'message_header': message_lines[0],
                    'message_body': '\n'.join(message_lines[1:]),
                    'parents_links': mark_safe(parents_links),
                    'main_panel_visible': True,
-                   'origin_context': origin_context,
+                   'snapshot_context': snapshot_context,
                    'dirs': dirs,
                    'files': files,
                    'content': content,
                    'content_size': content_size,
                    'max_content_size': content_display_max_size,
                    'mimetype': mimetype,
                    'language': language,
                    'readme_name': readme_name,
                    'readme_url': readme_url,
                    'breadcrumbs': breadcrumbs,
                    'top_right_link': top_right_link,
                    'top_right_link_text': top_right_link_text,
                    'vault_cooking': vault_cooking,
                    'diff_revision_url': diff_revision_url,
                    'show_actions_menu': True})
 
 
 NB_LOG_ENTRIES = 20
 
 
 @browse_route(r'revision/(?P<sha1_git>[0-9a-f]+)/log/',
               view_name='browse-revision-log')
 def revision_log_browse(request, sha1_git):
     """
     Django view that produces an HTML display of the history
     log for a SWH revision identified by its id.
 
     The url that points to it is :http:get:`/browse/revision/(sha1_git)/log/`.
     """ # noqa
     try:
         per_page = int(request.GET.get('per_page', NB_LOG_ENTRIES))
         revision_log = service.lookup_revision_log(sha1_git,
                                                    limit=per_page+1)
         revision_log = list(revision_log)
     except Exception as exc:
         return handle_view_exception(request, exc)
 
     revs_breadcrumb = request.GET.get('revs_breadcrumb', None)
 
     revision_log_display_data = prepare_revision_log_for_display(
         revision_log, per_page, revs_breadcrumb)
 
     prev_rev = revision_log_display_data['prev_rev']
     prev_revs_breadcrumb = revision_log_display_data['prev_revs_breadcrumb']
     prev_log_url = None
     if prev_rev:
         prev_log_url = \
             reverse('browse-revision-log',
                     kwargs={'sha1_git': prev_rev},
                     query_params={'revs_breadcrumb': prev_revs_breadcrumb,
                                   'per_page': per_page})
 
     next_rev = revision_log_display_data['next_rev']
     next_revs_breadcrumb = revision_log_display_data['next_revs_breadcrumb']
     next_log_url = None
     if next_rev:
         next_log_url = \
             reverse('browse-revision-log',
                     kwargs={'sha1_git': next_rev},
                     query_params={'revs_breadcrumb': next_revs_breadcrumb,
                                   'per_page': per_page})
 
     revision_log_data = revision_log_display_data['revision_log_data']
 
     for log in revision_log_data:
         log['directory'] = gen_directory_link(
             log['directory'],
             link_text='<i class="fa fa-folder-open fa-fw" aria-hidden="true">'
                       '</i>Browse files',
             link_attrs={'class': 'btn btn-md btn-swh',
                         'role': 'button'})
 
     return render(request, 'revision-log.html',
                   {'empty_browse': False,
                    'heading': 'Revision history information',
                    'top_panel_visible': False,
                    'top_panel_collapsible': False,
                    'top_panel_text': 'SWH object: Revision history',
                    'swh_object_metadata': None,
                    'main_panel_visible': True,
                    'revision_log': revision_log_data,
                    'next_log_url': next_log_url,
                    'prev_log_url': prev_log_url,
                    'breadcrumbs': None,
                    'top_right_link': None,
                    'top_right_link_text': None,
-                   'origin_context': None,
+                   'snapshot_context': None,
                    'vault_cooking': None,
                    'show_actions_menu': False})
diff --git a/swh/web/browse/views/snapshot.py b/swh/web/browse/views/snapshot.py
new file mode 100644
index 00000000..fed53334
--- /dev/null
+++ b/swh/web/browse/views/snapshot.py
@@ -0,0 +1,86 @@
+# Copyright (C) 2018  The Software Heritage developers
+# See the AUTHORS file at the top-level directory of this distribution
+# License: GNU General Public License version 3, or any later version
+# See top-level LICENSE file for more information
+
+
+from django.shortcuts import redirect
+
+from swh.web.browse.browseurls import browse_route
+from swh.web.common.utils import reverse
+
+from .utils.snapshot_context import (
+    browse_snapshot_directory, browse_snapshot_content,
+    browse_snapshot_log, browse_snapshot_branches,
+    browse_snapshot_releases
+)
+
+
+@browse_route(r'snapshot/(?P<snapshot_id>[0-9a-f]+)/',
+              view_name='browse-snapshot')
+def snapshot_browse(request, snapshot_id):
+    """Django view for browsing the content of a SWH snapshot.
+
+    The url that points to it is :http:get:`/browse/snapshot/(snapshot_id)/`
+    """
+    browse_snapshot_url = reverse('browse-snapshot-directory',
+                                  kwargs={'snapshot_id': snapshot_id},
+                                  query_params=request.GET)
+    return redirect(browse_snapshot_url)
+
+
+@browse_route(r'snapshot/(?P<snapshot_id>[0-9a-f]+)/directory/',
+              r'snapshot/(?P<snapshot_id>[0-9a-f]+)/directory/(?P<path>.+)/',
+              view_name='browse-snapshot-directory')
+def snapshot_directory_browse(request, snapshot_id, path=None):
+    """Django view for browsing the content of a SWH directory collected
+    in a SWH snapshot.
+
+    The url that points to it is :http:get:`/browse/snapshot/(snapshot_id)/directory/[(path)/]`
+    """ # noqa
+    return browse_snapshot_directory(request, snapshot_id=snapshot_id,
+                                     path=path)
+
+
+@browse_route(r'snapshot/(?P<snapshot_id>[0-9a-f]+)/content/(?P<path>.+)/',
+              view_name='browse-snapshot-content')
+def snapshot_content_browse(request, snapshot_id, path):
+    """Django view that produces an HTML display of a SWH content
+    collected in a SWH snapshot.
+
+    The url that points to it is :http:get:`/browse/snapshot/(snapshot_id)/content/(path)/`
+    """ # noqa
+    return browse_snapshot_content(request, snapshot_id=snapshot_id, path=path)
+
+
+@browse_route(r'snapshot/(?P<snapshot_id>[0-9a-f]+)/log/',
+              view_name='browse-snapshot-log')
+def snapshot_log_browse(request, snapshot_id):
+    """Django view that produces an HTML display of revisions history (aka
+    the commit log) collected in a SWH snapshot.
+
+    The url that points to it is :http:get:`/browse/snapshot/(snapshot_id)/log/`
+    """ # noqa
+    return browse_snapshot_log(request, snapshot_id=snapshot_id)
+
+
+@browse_route(r'snapshot/(?P<snapshot_id>[0-9a-f]+)/branches/',
+              view_name='browse-snapshot-branches')
+def snapshot_branches_browse(request, snapshot_id):
+    """Django view that produces an HTML display of the list of releases
+    collected in a SWH snapshot.
+
+    The url that points to it is :http:get:`/browse/snapshot/(snapshot_id)/branches/`
+    """ # noqa
+    return browse_snapshot_branches(request, snapshot_id=snapshot_id)
+
+
+@browse_route(r'snapshot/(?P<snapshot_id>[0-9a-f]+)/releases/',
+              view_name='browse-snapshot-releases')
+def snapshot_releases_browse(request, snapshot_id):
+    """Django view that produces an HTML display of the list of releases
+    collected in a SWH snapshot.
+
+    The url that points to it is :http:get:`/browse/snapshot/(snapshot_id)/releases/`
+    """ # noqa
+    return browse_snapshot_releases(request, snapshot_id=snapshot_id)
diff --git a/swh/web/browse/views/utils/__init__.py b/swh/web/browse/views/utils/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/swh/web/browse/views/utils/snapshot_context.py b/swh/web/browse/views/utils/snapshot_context.py
new file mode 100644
index 00000000..eb1e1346
--- /dev/null
+++ b/swh/web/browse/views/utils/snapshot_context.py
@@ -0,0 +1,763 @@
+# Copyright (C) 2018  The Software Heritage developers
+# See the AUTHORS file at the top-level directory of this distribution
+# License: GNU General Public License version 3, or any later version
+# See top-level LICENSE file for more information
+
+# Utility module implementing Django views for browsing the SWH archive
+# in a snapshot context.
+# Its purpose is to factorize code for the views reachable from the
+# /origin/.* and /snapshot/.* endpoints.
+
+from django.shortcuts import render
+from django.utils.safestring import mark_safe
+from django.template.defaultfilters import filesizeformat
+
+from swh.web.browse.utils import (
+    get_snapshot_context, get_directory_entries, gen_directory_link,
+    gen_revision_link, request_content, gen_content_link,
+    prepare_content_for_display, content_display_max_size,
+    prepare_revision_log_for_display, gen_snapshot_directory_link,
+    gen_revision_log_link, gen_link
+)
+
+from swh.web.common import service
+from swh.web.common.exc import (
+    handle_view_exception, NotFoundExc
+)
+from swh.web.common.utils import (
+    reverse, gen_path_info, format_utc_iso_date
+)
+
+
+def _get_branch(branches, branch_name):
+    """
+    Utility function to get a specific branch from a branches list.
+    Its purpose is to get the default HEAD branch as some SWH origin
+    (e.g those with svn type) does not have it. In that latter case, check
+    if there is a master branch instead and returns it.
+    """
+    filtered_branches = \
+        [b for b in branches if b['name'].endswith(branch_name)]
+    if len(filtered_branches) > 0:
+        return filtered_branches[0]
+    elif branch_name == 'HEAD':
+        filtered_branches = \
+            [b for b in branches if b['name'].endswith('master')]
+        if len(filtered_branches) > 0:
+            return filtered_branches[0]
+        elif len(branches) > 0:
+            return branches[0]
+    return None
+
+
+def _get_release(releases, release_name):
+    """
+    Utility function to get a specific release from a releases list.
+    Returns None if the release can not be found in the list.
+    """
+    filtered_releases = \
+        [r for r in releases if r['name'] == release_name]
+    if len(filtered_releases) > 0:
+        return filtered_releases[0]
+    else:
+        return None
+
+
+def _branch_not_found(branch_type, branch, branches, snapshot_id=None,
+                      origin_info=None, timestamp=None, visit_id=None):
+    """
+    Utility function to raise an exception when a specified branch/release
+    can not be found.
+    """
+    if branch_type == 'branch':
+        branch_type = 'Branch'
+        branch_type_plural = 'branches'
+    else:
+        branch_type = 'Release'
+        branch_type_plural = 'releases'
+
+    if snapshot_id and len(branches) == 0:
+        msg = 'Snapshot with id %s has an empty list' \
+              ' of %s!' % (snapshot_id, branch_type_plural)
+    elif snapshot_id:
+        msg = '%s %s for snapshot with id %s' \
+              ' not found!' % (branch_type, branch, snapshot_id)
+    elif visit_id and len(branches) == 0:
+        msg = 'Origin with type %s and url %s' \
+              ' for visit with id %s has an empty list' \
+              ' of %s!' % (origin_info['type'], origin_info['url'], visit_id,
+                           branch_type_plural)
+    elif visit_id:
+        msg = '%s %s associated to visit with' \
+              ' id %s for origin with type %s and url %s' \
+              ' not found!' % (branch_type, branch, visit_id,
+                               origin_info['type'], origin_info['url'])
+    elif len(branches) == 0:
+        msg = 'Origin with type %s and url %s' \
+                ' for visit with timestamp %s has an empty list' \
+                ' of %s!' % (origin_info['type'], origin_info['url'],
+                             timestamp, branch_type_plural)
+    else:
+        msg = '%s %s associated to visit with'  \
+              ' timestamp %s for origin with type %s' \
+              ' and url %s not found!' % (branch_type, branch, timestamp,
+                                          origin_info['type'],
+                                          origin_info['url'])
+    raise NotFoundExc(msg)
+
+
+def _process_snapshot_request(request, snapshot_id=None, origin_type=None,
+                              origin_url=None, timestamp=None, path=None,
+                              browse_context='directory'):
+    """
+    Utility function to perform common input request processing
+    for snapshot context views.
+    """
+
+    visit_id = request.GET.get('visit_id', None)
+
+    snapshot_context = get_snapshot_context(snapshot_id, origin_type,
+                                            origin_url, timestamp, visit_id)
+
+    swh_type = snapshot_context['swh_type']
+    origin_info = snapshot_context['origin_info']
+    branches = snapshot_context['branches']
+    releases = snapshot_context['releases']
+    url_args = snapshot_context['url_args']
+    query_params = snapshot_context['query_params']
+
+    browse_view_name = 'browse-' + swh_type + '-' + browse_context
+
+    for b in branches:
+        branch_url_args = dict(url_args)
+        branch_query_params = dict(query_params)
+        branch_query_params['branch'] = b['name']
+        if path:
+            b['path'] = path
+            branch_url_args['path'] = path
+        b['url'] = reverse(browse_view_name,
+                           kwargs=branch_url_args,
+                           query_params=branch_query_params)
+
+    for r in releases:
+        release_url_args = dict(url_args)
+        release_query_params = dict(query_params)
+        release_query_params['release'] = r['name']
+        if path:
+            r['path'] = path
+            release_url_args['path'] = path
+        r['url'] = reverse(browse_view_name,
+                           kwargs=release_url_args,
+                           query_params=release_query_params)
+
+    root_sha1_git = None
+    revision_id = request.GET.get('revision', None)
+    release_name = request.GET.get('release', None)
+    branch_name = None
+
+    if revision_id:
+        revision = service.lookup_revision(revision_id)
+        root_sha1_git = revision['directory']
+        branches.append({'name': revision_id,
+                         'revision': revision_id,
+                         'directory': root_sha1_git,
+                         'url': None})
+        branch_name = revision_id
+        query_params['revision'] = revision_id
+    elif release_name:
+        release = _get_release(releases, release_name)
+        if release:
+            root_sha1_git = release['directory']
+            revision_id = release['target']
+            query_params['release'] = release_name
+        else:
+            _branch_not_found("release", release_name, releases, snapshot_id,
+                              origin_info, timestamp, visit_id)
+    else:
+        branch_name = request.GET.get('branch', None)
+        if branch_name:
+            query_params['branch'] = branch_name
+        branch = _get_branch(branches, branch_name or 'HEAD')
+        if branch:
+            branch_name = branch['name']
+            root_sha1_git = branch['directory']
+            revision_id = branch['revision']
+
+        else:
+            _branch_not_found("branch", branch_name, branches, snapshot_id,
+                              origin_info, timestamp, visit_id)
+
+    snapshot_context['query_params'] = query_params
+    snapshot_context['root_sha1_git'] = root_sha1_git
+    snapshot_context['revision_id'] = revision_id
+    snapshot_context['branch'] = branch_name
+    snapshot_context['release'] = release_name
+
+    return snapshot_context
+
+
+def browse_snapshot_directory(request, snapshot_id=None, origin_type=None,
+                              origin_url=None, timestamp=None, path=None):
+    """
+    Django view implementation for browsing a directory in a snapshot context.
+    """
+    try:
+
+        snapshot_context = _process_snapshot_request(request, snapshot_id,
+                                                     origin_type, origin_url,
+                                                     timestamp, path,
+                                                     browse_context='directory') # noqa
+
+        root_sha1_git = snapshot_context['root_sha1_git']
+        sha1_git = root_sha1_git
+        if path:
+            dir_info = service.lookup_directory_with_path(root_sha1_git, path)
+            sha1_git = dir_info['target']
+
+        dirs, files = get_directory_entries(sha1_git)
+
+    except Exception as exc:
+        return handle_view_exception(request, exc)
+
+    swh_type = snapshot_context['swh_type']
+    origin_info = snapshot_context['origin_info']
+    visit_info = snapshot_context['visit_info']
+    url_args = snapshot_context['url_args']
+    query_params = snapshot_context['query_params']
+    revision_id = snapshot_context['revision_id']
+    snapshot_id = snapshot_context['snapshot_id']
+
+    path_info = gen_path_info(path)
+
+    browse_view_name = 'browse-' + swh_type + '-directory'
+
+    breadcrumbs = []
+    breadcrumbs.append({'name': root_sha1_git[:7],
+                        'url': reverse(browse_view_name,
+                                       kwargs=url_args,
+                                       query_params=query_params)})
+    for pi in path_info:
+        bc_url_args = dict(url_args)
+        bc_url_args['path'] = pi['path']
+        breadcrumbs.append({'name': pi['name'],
+                            'url': reverse(browse_view_name,
+                                           kwargs=bc_url_args,
+                                           query_params=query_params)})
+
+    path = '' if path is None else (path + '/')
+
+    for d in dirs:
+        bc_url_args = dict(url_args)
+        bc_url_args['path'] = path + d['name']
+        d['url'] = reverse(browse_view_name,
+                           kwargs=bc_url_args,
+                           query_params=query_params)
+
+    sum_file_sizes = 0
+
+    readme_name = None
+    readme_url = None
+
+    browse_view_name = 'browse-' + swh_type + '-content'
+
+    for f in files:
+        bc_url_args = dict(url_args)
+        bc_url_args['path'] = path + f['name']
+        f['url'] = reverse(browse_view_name,
+                           kwargs=bc_url_args,
+                           query_params=query_params)
+        sum_file_sizes += f['length']
+        f['length'] = filesizeformat(f['length'])
+        if f['name'].lower().startswith('readme'):
+            readme_name = f['name']
+            readme_sha1 = f['checksums']['sha1']
+            readme_url = reverse('browse-content-raw',
+                                 kwargs={'query_string': readme_sha1})
+
+    browse_view_name = 'browse-' + swh_type + '-log'
+
+    history_url = reverse(browse_view_name,
+                          kwargs=url_args,
+                          query_params=query_params)
+
+    sum_file_sizes = filesizeformat(sum_file_sizes)
+
+    browse_dir_link = \
+        gen_directory_link(sha1_git, link_text='Browse',
+                           link_attrs={'class': 'btn btn-md btn-swh',
+                                       'role': 'button'})
+
+    browse_rev_link = \
+        gen_revision_link(revision_id,
+                          snapshot_context=snapshot_context,
+                          link_text='Browse',
+                          link_attrs={'class': 'btn btn-md btn-swh',
+                                      'role': 'button'})
+
+    dir_metadata = {'id': sha1_git,
+                    'context-independent directory': browse_dir_link,
+                    'number of regular files': len(files),
+                    'number of subdirectories': len(dirs),
+                    'sum of regular file sizes': sum_file_sizes,
+                    'path': '/' + path,
+                    'revision id': revision_id,
+                    'revision': browse_rev_link,
+                    'snapshot id': snapshot_id}
+
+    if origin_info:
+        dir_metadata['origin id'] = origin_info['id']
+        dir_metadata['origin type'] = origin_info['type']
+        dir_metadata['origin url'] = origin_info['url']
+        dir_metadata['origin visit date'] = format_utc_iso_date(visit_info['date']), # noqa
+        dir_metadata['origin visit id'] = visit_info['visit']
+        snapshot_context_url = reverse('browse-snapshot-directory',
+                                       kwargs={'snapshot_id': snapshot_id},
+                                       query_params=request.GET)
+        browse_snapshot_link = \
+            gen_link(snapshot_context_url, link_text='Browse',
+                     link_attrs={'class': 'btn btn-md btn-swh',
+                                 'role': 'button'})
+        dir_metadata['snapshot context'] = browse_snapshot_link
+
+    vault_cooking = {
+        'directory_context': True,
+        'directory_id': sha1_git,
+        'revision_context': True,
+        'revision_id': revision_id
+    }
+
+    return render(request, 'directory.html',
+                  {'empty_browse': False,
+                   'heading': 'Directory information',
+                   'top_panel_visible': True,
+                   'top_panel_collapsible': True,
+                   'top_panel_text': 'SWH object: Directory',
+                   'swh_object_metadata': dir_metadata,
+                   'main_panel_visible': True,
+                   'dirs': dirs,
+                   'files': files,
+                   'breadcrumbs': breadcrumbs,
+                   'top_right_link': history_url,
+                   'top_right_link_text': mark_safe(
+                     '<i class="fa fa-history fa-fw" aria-hidden="true"></i>'
+                     'History'
+                   ),
+                   'readme_name': readme_name,
+                   'readme_url': readme_url,
+                   'snapshot_context': snapshot_context,
+                   'vault_cooking': vault_cooking,
+                   'show_actions_menu': True})
+
+
+def browse_snapshot_content(request, snapshot_id=None, origin_type=None,
+                            origin_url=None, timestamp=None, path=None):
+    """
+    Django view implementation for browsing a content in a snapshot context.
+    """
+    try:
+
+        snapshot_context = _process_snapshot_request(request, snapshot_id,
+                                                     origin_type, origin_url,
+                                                     timestamp, path,
+                                                     browse_context='content')
+
+        root_sha1_git = snapshot_context['root_sha1_git']
+        content_info = service.lookup_directory_with_path(root_sha1_git, path)
+        sha1_git = content_info['target']
+        query_string = 'sha1_git:' + sha1_git
+        content_data = request_content(query_string)
+
+    except Exception as exc:
+        return handle_view_exception(request, exc)
+
+    swh_type = snapshot_context['swh_type']
+    url_args = snapshot_context['url_args']
+    query_params = snapshot_context['query_params']
+    revision_id = snapshot_context['revision_id']
+    origin_info = snapshot_context['origin_info']
+    visit_info = snapshot_context['visit_info']
+    snapshot_id = snapshot_context['snapshot_id']
+
+    content = None
+    language = None
+    if content_data['raw_data'] is not None:
+        content_display_data = prepare_content_for_display(
+            content_data['raw_data'], content_data['mimetype'], path)
+        content = content_display_data['content_data']
+        language = content_display_data['language']
+
+    filename = None
+    path_info = None
+
+    browse_view_name = 'browse-' + swh_type + '-directory'
+
+    breadcrumbs = []
+
+    split_path = path.split('/')
+    filename = split_path[-1]
+    path = path[:-len(filename)]
+    path_info = gen_path_info(path)
+    breadcrumbs.append({'name': root_sha1_git[:7],
+                        'url': reverse(browse_view_name,
+                                       kwargs=url_args,
+                                       query_params=query_params)})
+    for pi in path_info:
+        bc_url_args = dict(url_args)
+        bc_url_args['path'] = pi['path']
+        breadcrumbs.append({'name': pi['name'],
+                            'url': reverse(browse_view_name,
+                                           kwargs=bc_url_args,
+                                           query_params=query_params)})
+
+    breadcrumbs.append({'name': filename,
+                        'url': None})
+
+    browse_content_link = \
+        gen_content_link(sha1_git, link_text='Browse',
+                         link_attrs={'class': 'btn btn-md btn-swh',
+                                     'role': 'button'})
+
+    content_raw_url = reverse('browse-content-raw',
+                              kwargs={'query_string': query_string},
+                              query_params={'filename': filename})
+
+    browse_rev_link = \
+        gen_revision_link(revision_id,
+                          snapshot_context=snapshot_context,
+                          link_text='Browse',
+                          link_attrs={'class': 'btn btn-md btn-swh',
+                                      'role': 'button'})
+
+    content_metadata = {
+        'context-independent content': browse_content_link,
+        'sha1 checksum': content_data['checksums']['sha1'],
+        'sha1_git checksum': content_data['checksums']['sha1_git'],
+        'sha256 checksum': content_data['checksums']['sha256'],
+        'blake2s256 checksum': content_data['checksums']['blake2s256'],
+        'mime type': content_data['mimetype'],
+        'encoding': content_data['encoding'],
+        'size': filesizeformat(content_data['length']),
+        'language': content_data['language'],
+        'licenses': content_data['licenses'],
+        'path': '/' + path,
+        'filename': filename,
+        'revision id': revision_id,
+        'revision': browse_rev_link,
+        'snapshot id': snapshot_id
+    }
+
+    if origin_info:
+        content_metadata['origin id'] = origin_info['id'],
+        content_metadata['origin type'] = origin_info['type']
+        content_metadata['origin url'] = origin_info['url']
+        content_metadata['origin visit date'] = format_utc_iso_date(visit_info['date']) # noqa
+        content_metadata['origin visit id'] = visit_info['visit']
+        browse_snapshot_url = reverse('browse-snapshot-content',
+                                      kwargs={'snapshot_id': snapshot_id,
+                                              'path': path},
+                                      query_params=request.GET)
+        browse_snapshot_link = \
+            gen_link(browse_snapshot_url, link_text='Browse',
+                     link_attrs={'class': 'btn btn-md btn-swh',
+                                 'role': 'button'})
+        content_metadata['snapshot context'] = browse_snapshot_link
+
+    return render(request, 'content.html',
+                  {'empty_browse': False,
+                   'heading': 'Content information',
+                   'top_panel_visible': True,
+                   'top_panel_collapsible': True,
+                   'top_panel_text': 'SWH object: Content',
+                   'swh_object_metadata': content_metadata,
+                   'main_panel_visible': True,
+                   'content': content,
+                   'content_size': content_data['length'],
+                   'max_content_size': content_display_max_size,
+                   'mimetype': content_data['mimetype'],
+                   'language': language,
+                   'breadcrumbs': breadcrumbs,
+                   'top_right_link': content_raw_url,
+                   'top_right_link_text': mark_safe(
+                       '<i class="fa fa-file-text fa-fw" aria-hidden="true">'
+                       '</i>Raw File'),
+                   'snapshot_context': snapshot_context,
+                   'vault_cooking': None,
+                   'show_actions_menu': False})
+
+
+PER_PAGE = 20
+
+
+def browse_snapshot_log(request, snapshot_id=None, origin_type=None,
+                        origin_url=None, timestamp=None):
+    """
+    Django view implementation for browsing a revision history in a
+    snapshot context.
+    """
+    try:
+
+        snapshot_context = _process_snapshot_request(request, snapshot_id,
+                                                     origin_type, origin_url,
+                                                     timestamp, browse_context='log') # noqa
+
+        revision_id = snapshot_context['revision_id']
+        current_rev = revision_id
+        per_page = int(request.GET.get('per_page', PER_PAGE))
+        revs_breadcrumb = request.GET.get('revs_breadcrumb', None)
+
+        if revs_breadcrumb:
+            current_rev = revs_breadcrumb.split('/')[-1]
+        revision_log = service.lookup_revision_log(current_rev,
+                                                   limit=per_page+1)
+        revision_log = list(revision_log)
+
+    except Exception as exc:
+        return handle_view_exception(request, exc)
+
+    swh_type = snapshot_context['swh_type']
+    origin_info = snapshot_context['origin_info']
+    visit_info = snapshot_context['visit_info']
+    url_args = snapshot_context['url_args']
+    query_params = snapshot_context['query_params']
+    snapshot_id = snapshot_context['snapshot_id']
+
+    query_params['per_page'] = per_page
+
+    revision_log_display_data = prepare_revision_log_for_display(
+        revision_log, per_page, revs_breadcrumb, snapshot_context)
+
+    browse_view_name = 'browse-' + swh_type + '-log'
+
+    prev_rev = revision_log_display_data['prev_rev']
+    prev_revs_breadcrumb = revision_log_display_data['prev_revs_breadcrumb']
+    prev_log_url = None
+    query_params['revs_breadcrumb'] = prev_revs_breadcrumb
+    if prev_rev:
+        prev_log_url = \
+            reverse(browse_view_name,
+                    kwargs=url_args,
+                    query_params=query_params)
+
+    next_rev = revision_log_display_data['next_rev']
+    next_revs_breadcrumb = revision_log_display_data['next_revs_breadcrumb']
+    next_log_url = None
+    query_params['revs_breadcrumb'] = next_revs_breadcrumb
+    if next_rev:
+        next_log_url = \
+            reverse(browse_view_name,
+                    kwargs=url_args,
+                    query_params=query_params)
+
+    revision_log_data = revision_log_display_data['revision_log_data']
+
+    for i, log in enumerate(revision_log_data):
+        params = {
+            'revision': revision_log[i]['id'],
+        }
+        if 'visit_id' in query_params:
+            params['visit_id'] = query_params['visit_id']
+        log['directory'] = gen_snapshot_directory_link(
+            snapshot_context, revision_log[i]['id'],
+            link_text='<i class="fa fa-folder-open fa-fw" aria-hidden="true">'
+                      '</i>Browse files',
+            link_attrs={'class': 'btn btn-md btn-swh',
+                        'role': 'button'})
+
+    browse_log_link = \
+        gen_revision_log_link(revision_id, link_text='Browse',
+                              link_attrs={'class': 'btn btn-md btn-swh',
+                                          'role': 'button'})
+
+    revision_metadata = {
+        'context-independent revision history': browse_log_link,
+        'snapshot id': snapshot_id
+    }
+
+    if origin_info:
+        revision_metadata['origin id'] = origin_info['id']
+        revision_metadata['origin type'] = origin_info['type']
+        revision_metadata['origin url'] = origin_info['url']
+        revision_metadata['origin visit date'] = format_utc_iso_date(visit_info['date']) # noqa
+        revision_metadata['origin visit id'] = visit_info['visit']
+        browse_snapshot_url = reverse('browse-snapshot-log',
+                                      kwargs={'snapshot_id': snapshot_id},
+                                      query_params=request.GET)
+        browse_snapshot_link = \
+            gen_link(browse_snapshot_url, link_text='Browse',
+                     link_attrs={'class': 'btn btn-md btn-swh',
+                                 'role': 'button'})
+        revision_metadata['snapshot context'] = browse_snapshot_link
+
+    return render(request, 'revision-log.html',
+                  {'empty_browse': False,
+                   'heading': 'Revision history information',
+                   'top_panel_visible': True,
+                   'top_panel_collapsible': True,
+                   'top_panel_text': 'SWH object: Revision history',
+                   'swh_object_metadata': revision_metadata,
+                   'main_panel_visible': True,
+                   'revision_log': revision_log_data,
+                   'next_log_url': next_log_url,
+                   'prev_log_url': prev_log_url,
+                   'breadcrumbs': None,
+                   'top_right_link': None,
+                   'top_right_link_text': None,
+                   'snapshot_context': snapshot_context,
+                   'vault_cooking': None,
+                   'show_actions_menu': False})
+
+
+def browse_snapshot_branches(request, snapshot_id=None, origin_type=None,
+                             origin_url=None, timestamp=None):
+    """
+    Django view implementation for browsing a list of branches in a snapshot
+    context.
+    """
+    try:
+        snapshot_context = _process_snapshot_request(request, snapshot_id,
+                                                     origin_type, origin_url,
+                                                     timestamp)
+
+    except Exception as exc:
+        return handle_view_exception(request, exc)
+
+    branches_offset = int(request.GET.get('branches_offset', 0))
+
+    swh_type = snapshot_context['swh_type']
+    origin_info = snapshot_context['origin_info']
+    url_args = snapshot_context['url_args']
+    query_params = snapshot_context['query_params']
+
+    browse_view_name = 'browse-' + swh_type + '-directory'
+
+    branches = snapshot_context['branches']
+
+    displayed_branches = \
+        branches[branches_offset:branches_offset+PER_PAGE]
+
+    for branch in displayed_branches:
+        if snapshot_id:
+            revision_url = reverse('browse-revision',
+                                   kwargs={'sha1_git': branch['revision']},
+                                   query_params={'snapshot_id': snapshot_id})
+        else:
+            revision_url = reverse('browse-revision',
+                                   kwargs={'sha1_git': branch['revision']},
+                                   query_params={'origin_type': origin_info['type'], # noqa
+                                                 'origin_url': origin_info['url']}) # noqa
+        query_params['branch'] = branch['name']
+        directory_url = reverse(browse_view_name,
+                                kwargs=url_args,
+                                query_params=query_params)
+        del query_params['branch']
+        branch['revision_url'] = revision_url
+        branch['directory_url'] = directory_url
+
+    browse_view_name = 'browse-' + swh_type + '-branches'
+
+    prev_branches_url = None
+    next_branches_url = None
+
+    next_offset = branches_offset + PER_PAGE
+    prev_offset = branches_offset - PER_PAGE
+    if next_offset < len(branches):
+        query_params['branches_offset'] = next_offset
+        next_branches_url = reverse(browse_view_name,
+                                    kwargs=url_args, query_params=query_params)
+    query_params['branches_offset'] = None
+    if prev_offset >= 0:
+        if prev_offset != 0:
+            query_params['branches_offset'] = prev_offset
+        prev_branches_url = reverse(browse_view_name,
+                                    kwargs=url_args, query_params=query_params)
+
+    return render(request, 'branches.html',
+                  {'empty_browse': False,
+                   'heading': 'Origin branches list',
+                   'top_panel_visible': False,
+                   'top_panel_collapsible': False,
+                   'top_panel_text': 'SWH object: Branches list',
+                   'swh_object_metadata': {},
+                   'main_panel_visible': True,
+                   'top_right_link': None,
+                   'top_right_link_text': None,
+                   'displayed_branches': displayed_branches,
+                   'prev_branches_url': prev_branches_url,
+                   'next_branches_url': next_branches_url,
+                   'snapshot_context': snapshot_context})
+
+
+def browse_snapshot_releases(request, snapshot_id=None, origin_type=None,
+                             origin_url=None, timestamp=None):
+    """
+    Django view implementation for browsing a list of releases in a snapshot
+    context.
+    """
+    try:
+        snapshot_context = _process_snapshot_request(request, snapshot_id,
+                                                     origin_type, origin_url,
+                                                     timestamp)
+
+    except Exception as exc:
+        return handle_view_exception(request, exc)
+
+    releases_offset = int(request.GET.get('releases_offset', 0))
+
+    swh_type = snapshot_context['swh_type']
+    origin_info = snapshot_context['origin_info']
+    url_args = snapshot_context['url_args']
+    query_params = snapshot_context['query_params']
+
+    releases = snapshot_context['releases']
+
+    displayed_releases = \
+        releases[releases_offset:releases_offset+PER_PAGE]
+
+    for release in displayed_releases:
+        if snapshot_id:
+            release_url = reverse('browse-release',
+                                  kwargs={'sha1_git': release['id']},
+                                  query_params={'snapshot_id': snapshot_id})
+        else:
+            release_url = reverse('browse-release',
+                                  kwargs={'sha1_git': release['id']},
+                                  query_params={'origin_type': origin_info['type'], # noqa
+                                                'origin_url': origin_info['url']}) # noqa
+        query_params['release'] = release['name']
+        del query_params['release']
+        release['release_url'] = release_url
+
+    browse_view_name = 'browse-' + swh_type + '-releases'
+
+    prev_releases_url = None
+    next_releases_url = None
+
+    next_offset = releases_offset + PER_PAGE
+    prev_offset = releases_offset - PER_PAGE
+    if next_offset < len(releases):
+        query_params['releases_offset'] = next_offset
+        next_releases_url = reverse(browse_view_name,
+                                    kwargs=url_args, query_params=query_params)
+    query_params['releases_offset'] = None
+    if prev_offset >= 0:
+        if prev_offset != 0:
+            query_params['releases_offset'] = prev_offset
+        prev_releases_url = reverse(browse_view_name,
+                                    kwargs=url_args, query_params=query_params)
+
+    return render(request, 'releases.html',
+                  {'empty_browse': False,
+                   'heading': 'Origin releases list',
+                   'top_panel_visible': False,
+                   'top_panel_collapsible': False,
+                   'top_panel_text': 'SWH object: Releases list',
+                   'swh_object_metadata': {},
+                   'main_panel_visible': True,
+                   'top_right_link': None,
+                   'top_right_link_text': None,
+                   'displayed_releases': displayed_releases,
+                   'prev_releases_url': prev_releases_url,
+                   'next_releases_url': next_releases_url,
+                   'snapshot_context': snapshot_context,
+                   'vault_cooking': None,
+                   'show_actions_menu': False})
diff --git a/swh/web/common/service.py b/swh/web/common/service.py
index 2053c0cf..2533d24a 100644
--- a/swh/web/common/service.py
+++ b/swh/web/common/service.py
@@ -1,940 +1,942 @@
 # Copyright (C) 2015-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU Affero General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 import os
 
 from collections import defaultdict
 
 from swh.model import hashutil
 
 from swh.web.common import converters
 from swh.web.common import query
 from swh.web.common.exc import NotFoundExc
 from swh.web import config
 
 storage = config.storage()
 vault = config.vault()
 idx_storage = config.indexer_storage()
 
 
 MAX_LIMIT = 50  # Top limit the users can ask for
 
 
 def _first_element(l):
     """Returns the first element in the provided list or None
     if it is empty or None"""
     return next(iter(l or []), None)
 
 
 def lookup_multiple_hashes(hashes):
     """Lookup the passed hashes in a single DB connection, using batch
     processing.
 
     Args:
         An array of {filename: X, sha1: Y}, string X, hex sha1 string Y.
     Returns:
         The same array with elements updated with elem['found'] = true if
         the hash is present in storage, elem['found'] = false if not.
 
     """
     hashlist = [hashutil.hash_to_bytes(elem['sha1']) for elem in hashes]
     content_missing = storage.content_missing_per_sha1(hashlist)
     missing = [hashutil.hash_to_hex(x) for x in content_missing]
     for x in hashes:
         x.update({'found': True})
     for h in hashes:
         if h['sha1'] in missing:
             h['found'] = False
     return hashes
 
 
 def lookup_expression(expression, last_sha1, per_page):
     """Lookup expression in raw content.
 
     Args:
         expression (str): An expression to lookup through raw indexed
         content
         last_sha1 (str): Last sha1 seen
         per_page (int): Number of results per page
 
     Returns:
         List of ctags whose content match the expression
 
     """
 
     limit = min(per_page, MAX_LIMIT)
     ctags = idx_storage.content_ctags_search(expression,
                                              last_sha1=last_sha1,
                                              limit=limit)
 
     for ctag in ctags:
         ctag = converters.from_swh(ctag, hashess={'id'})
         ctag['sha1'] = ctag['id']
         ctag.pop('id')
         yield ctag
 
 
 def lookup_hash(q):
     """Checks if the storage contains a given content checksum
 
     Args: query string of the form <hash_algo:hash>
 
     Returns: Dict with key found containing the hash info if the
     hash is present, None if not.
 
     """
     algo, hash = query.parse_hash(q)
     found = storage.content_find({algo: hash})
     return {'found': found,
             'algo': algo}
 
 
 def search_hash(q):
     """Checks if the storage contains a given content checksum
 
     Args: query string of the form <hash_algo:hash>
 
     Returns: Dict with key found to True or False, according to
         whether the checksum is present or not
 
     """
     algo, hash = query.parse_hash(q)
     found = storage.content_find({algo: hash})
     return {'found': found is not None}
 
 
 def lookup_content_provenance(q):
     """Return provenance information from a specified content.
 
     Args:
         q: query string of the form <hash_algo:hash>
 
     Yields:
         provenance information (dict) list if the content is found.
 
     """
     algo, hash = query.parse_hash(q)
     provenances = storage.content_find_provenance({algo: hash})
     if not provenances:
         return None
     return (converters.from_provenance(p) for p in provenances)
 
 
 def _lookup_content_sha1(q):
     """Given a possible input, query for the content's sha1.
 
     Args:
         q: query string of the form <hash_algo:hash>
 
     Returns:
         binary sha1 if found or None
 
     """
     algo, hash = query.parse_hash(q)
     if algo != 'sha1':
         hashes = storage.content_find({algo: hash})
         if not hashes:
             return None
         return hashes['sha1']
     return hash
 
 
 def lookup_content_ctags(q):
     """Return ctags information from a specified content.
 
     Args:
         q: query string of the form <hash_algo:hash>
 
     Yields:
         ctags information (dict) list if the content is found.
 
     """
     sha1 = _lookup_content_sha1(q)
 
     if not sha1:
         return None
 
     ctags = list(idx_storage.content_ctags_get([sha1]))
     if not ctags:
         return None
 
     for ctag in ctags:
         yield converters.from_swh(ctag, hashess={'id'})
 
 
 def lookup_content_filetype(q):
     """Return filetype information from a specified content.
 
     Args:
         q: query string of the form <hash_algo:hash>
 
     Yields:
         filetype information (dict) list if the content is found.
 
     """
     sha1 = _lookup_content_sha1(q)
     if not sha1:
         return None
     filetype = _first_element(list(idx_storage.content_mimetype_get([sha1])))
     if not filetype:
         return None
     return converters.from_filetype(filetype)
 
 
 def lookup_content_language(q):
     """Return language information from a specified content.
 
     Args:
         q: query string of the form <hash_algo:hash>
 
     Yields:
         language information (dict) list if the content is found.
 
     """
     sha1 = _lookup_content_sha1(q)
     if not sha1:
         return None
     lang = _first_element(list(idx_storage.content_language_get([sha1])))
     if not lang:
         return None
     return converters.from_swh(lang, hashess={'id'})
 
 
 def lookup_content_license(q):
     """Return license information from a specified content.
 
     Args:
         q: query string of the form <hash_algo:hash>
 
     Yields:
         license information (dict) list if the content is found.
 
     """
     sha1 = _lookup_content_sha1(q)
     if not sha1:
         return None
     lang = _first_element(idx_storage.content_fossology_license_get([sha1]))
     if not lang:
         return None
     return converters.from_swh(lang, hashess={'id'})
 
 
 def lookup_origin(origin):
     """Return information about the origin matching dict origin.
 
     Args:
         origin: origin's dict with keys either 'id' or
         ('type' AND 'url')
 
     Returns:
         origin information as dict.
 
     """
     origin_info = storage.origin_get(origin)
     if not origin_info:
         if 'id' in origin and origin['id']:
             msg = 'Origin with id %s not found!' % origin['id']
         else:
             msg = 'Origin of type %s and url %s not found!' % \
                 (origin['type'], origin['url'])
         raise NotFoundExc(msg)
     return converters.from_origin(origin_info)
 
 
 def search_origin(url_pattern, offset=0, limit=50, regexp=False):
     """Search for origins whose urls contain a provided string pattern
     or match a provided regular expression.
 
     Args:
         url_pattern: the string pattern to search for in origin urls
         offset: number of found origins to skip before returning results
         limit: the maximum number of found origins to return
 
     Returns:
         lisf of origin information as dict.
 
     """
     origins = storage.origin_search(url_pattern, offset, limit, regexp)
     return map(converters.from_origin, origins)
 
 
 def lookup_person(person_id):
     """Return information about the person with id person_id.
 
     Args:
         person_id as string
 
     Returns:
         person information as dict.
 
     Raises:
         NotFoundExc if there is no person with the provided id.
 
     """
     person = _first_element(storage.person_get([person_id]))
     if not person:
         raise NotFoundExc('Person with id %s not found' % person_id)
     return converters.from_person(person)
 
 
 def _to_sha1_bin(sha1_hex):
     _, sha1_git_bin = query.parse_hash_with_algorithms_or_throws(
         sha1_hex,
         ['sha1'],  # HACK: sha1_git really
         'Only sha1_git is supported.')
     return sha1_git_bin
 
 
 def lookup_directory(sha1_git):
     """Return information about the directory with id sha1_git.
 
     Args:
         sha1_git as string
 
     Returns:
         directory information as dict.
 
     """
     sha1_git_bin = _to_sha1_bin(sha1_git)
 
     dir = _first_element(storage.directory_get([sha1_git_bin]))
     if not dir:
         raise NotFoundExc('Directory with sha1_git %s not found' % sha1_git)
 
     directory_entries = storage.directory_ls(sha1_git_bin) or []
     return map(converters.from_directory_entry, directory_entries)
 
 
 def lookup_directory_with_path(directory_sha1_git, path_string):
     """Return directory information for entry with path path_string w.r.t.
     root directory pointed by directory_sha1_git
 
     Args:
         - directory_sha1_git: sha1_git corresponding to the directory
         to which we append paths to (hopefully) find the entry
         - the relative path to the entry starting from the directory pointed by
         directory_sha1_git
 
     Raises:
         NotFoundExc if the directory entry is not found
     """
     sha1_git_bin = _to_sha1_bin(directory_sha1_git)
 
     paths = path_string.strip(os.path.sep).split(os.path.sep)
     queried_dir = storage.directory_entry_get_by_path(
         sha1_git_bin, list(map(lambda p: p.encode('utf-8'), paths)))
 
     if not queried_dir:
         raise NotFoundExc(('Directory entry with path %s from %s not found') %
                           (path_string, directory_sha1_git))
 
     return converters.from_directory_entry(queried_dir)
 
 
 def lookup_release(release_sha1_git):
     """Return information about the release with sha1 release_sha1_git.
 
     Args:
         release_sha1_git: The release's sha1 as hexadecimal
 
     Returns:
         Release information as dict.
 
     Raises:
         ValueError if the identifier provided is not of sha1 nature.
 
     """
     sha1_git_bin = _to_sha1_bin(release_sha1_git)
     release = _first_element(storage.release_get([sha1_git_bin]))
     if not release:
         raise NotFoundExc('Release with sha1_git %s not found.'
                           % release_sha1_git)
     return converters.from_release(release)
 
 
 def lookup_release_multiple(sha1_git_list):
     """Return information about the revisions identified with
     their sha1_git identifiers.
 
     Args:
         sha1_git_list: A list of revision sha1_git identifiers
 
     Returns:
         Release information as dict.
 
     Raises:
         ValueError if the identifier provided is not of sha1 nature.
 
     """
     sha1_bin_list = (_to_sha1_bin(sha1_git) for sha1_git in sha1_git_list)
     releases = storage.release_get(sha1_bin_list) or []
     return (converters.from_release(r) for r in releases)
 
 
 def lookup_revision(rev_sha1_git):
     """Return information about the revision with sha1 revision_sha1_git.
 
     Args:
         revision_sha1_git: The revision's sha1 as hexadecimal
 
     Returns:
         Revision information as dict.
 
     Raises:
         ValueError if the identifier provided is not of sha1 nature.
         NotFoundExc if there is no revision with the provided sha1_git.
 
     """
     sha1_git_bin = _to_sha1_bin(rev_sha1_git)
     revision = _first_element(storage.revision_get([sha1_git_bin]))
     if not revision:
         raise NotFoundExc('Revision with sha1_git %s not found.'
                           % rev_sha1_git)
     return converters.from_revision(revision)
 
 
 def lookup_revision_multiple(sha1_git_list):
     """Return information about the revisions identified with
     their sha1_git identifiers.
 
     Args:
         sha1_git_list: A list of revision sha1_git identifiers
 
     Returns:
         Generator of revisions information as dict.
 
     Raises:
         ValueError if the identifier provided is not of sha1 nature.
 
     """
     sha1_bin_list = (_to_sha1_bin(sha1_git) for sha1_git in sha1_git_list)
     revisions = storage.revision_get(sha1_bin_list) or []
     return (converters.from_revision(r) for r in revisions)
 
 
 def lookup_revision_message(rev_sha1_git):
     """Return the raw message of the revision with sha1 revision_sha1_git.
 
     Args:
         revision_sha1_git: The revision's sha1 as hexadecimal
 
     Returns:
         Decoded revision message as dict {'message': <the_message>}
 
     Raises:
         ValueError if the identifier provided is not of sha1 nature.
         NotFoundExc if the revision is not found, or if it has no message
 
     """
     sha1_git_bin = _to_sha1_bin(rev_sha1_git)
 
     revision = _first_element(storage.revision_get([sha1_git_bin]))
     if not revision:
         raise NotFoundExc('Revision with sha1_git %s not found.'
                           % rev_sha1_git)
     if 'message' not in revision:
         raise NotFoundExc('No message for revision with sha1_git %s.'
                           % rev_sha1_git)
     res = {'message': revision['message']}
     return res
 
 
 def lookup_revision_by(origin_id,
                        branch_name="refs/heads/master",
                        timestamp=None):
     """Lookup revisions by origin_id, branch_name and timestamp.
 
     If:
     - branch_name is not provided, lookup using 'refs/heads/master' as default.
     - ts is not provided, use the most recent
 
     Args:
         - origin_id: origin of the revision.
         - branch_name: revision's branch.
         - timestamp: revision's time frame.
 
     Yields:
         The revisions matching the criterions.
 
     Raises:
         NotFoundExc if no revision corresponds to the criterion
 
     """
     res = _first_element(storage.revision_get_by(origin_id,
                                                  branch_name,
                                                  timestamp=timestamp,
                                                  limit=1))
     if not res:
         raise NotFoundExc('Revision for origin %s and branch %s not found.'
                           % (origin_id, branch_name))
     return converters.from_revision(res)
 
 
 def lookup_revision_log(rev_sha1_git, limit):
     """Return information about the revision with sha1 revision_sha1_git.
 
     Args:
         revision_sha1_git: The revision's sha1 as hexadecimal
         limit: the maximum number of revisions returned
 
     Returns:
         Revision information as dict.
 
     Raises:
         ValueError if the identifier provided is not of sha1 nature.
         NotFoundExc if there is no revision with the provided sha1_git.
 
     """
     sha1_git_bin = _to_sha1_bin(rev_sha1_git)
 
     revision_entries = storage.revision_log([sha1_git_bin], limit)
     if not revision_entries:
         raise NotFoundExc('Revision with sha1_git %s not found.'
                           % rev_sha1_git)
     return map(converters.from_revision, revision_entries)
 
 
 def lookup_revision_log_by(origin_id, branch_name, timestamp, limit):
     """Return information about the revision with sha1 revision_sha1_git.
 
     Args:
         origin_id: origin of the revision
         branch_name: revision's branch
         timestamp: revision's time frame
         limit: the maximum number of revisions returned
 
     Returns:
         Revision information as dict.
 
     Raises:
         NotFoundExc if no revision corresponds to the criterion
 
     """
     revision_entries = storage.revision_log_by(origin_id,
                                                branch_name,
                                                timestamp,
                                                limit=limit)
     if not revision_entries:
         return None
     return map(converters.from_revision, revision_entries)
 
 
 def lookup_revision_with_context_by(origin_id, branch_name, ts, sha1_git,
                                     limit=100):
     """Return information about revision sha1_git, limited to the
     sub-graph of all transitive parents of sha1_git_root.
     sha1_git_root being resolved through the lookup of a revision by origin_id,
     branch_name and ts.
 
     In other words, sha1_git is an ancestor of sha1_git_root.
 
     Args:
         - origin_id: origin of the revision.
         - branch_name: revision's branch.
         - timestamp: revision's time frame.
         - sha1_git: one of sha1_git_root's ancestors.
         - limit: limit the lookup to 100 revisions back.
 
     Returns:
         Pair of (root_revision, revision).
         Information on sha1_git if it is an ancestor of sha1_git_root
         including children leading to sha1_git_root
 
     Raises:
         - BadInputExc in case of unknown algo_hash or bad hash.
         - NotFoundExc if either revision is not found or if sha1_git is not an
         ancestor of sha1_git_root.
 
     """
     rev_root = _first_element(storage.revision_get_by(origin_id,
                                                       branch_name,
                                                       timestamp=ts,
                                                       limit=1))
     if not rev_root:
         raise NotFoundExc('Revision with (origin_id: %s, branch_name: %s'
                           ', ts: %s) not found.' % (origin_id,
                                                     branch_name,
                                                     ts))
 
     return (converters.from_revision(rev_root),
             lookup_revision_with_context(rev_root, sha1_git, limit))
 
 
 def lookup_revision_with_context(sha1_git_root, sha1_git, limit=100):
     """Return information about revision sha1_git, limited to the
     sub-graph of all transitive parents of sha1_git_root.
 
     In other words, sha1_git is an ancestor of sha1_git_root.
 
     Args:
         sha1_git_root: latest revision. The type is either a sha1 (as an hex
         string) or a non converted dict.
         sha1_git: one of sha1_git_root's ancestors
         limit: limit the lookup to 100 revisions back
 
     Returns:
         Information on sha1_git if it is an ancestor of sha1_git_root
         including children leading to sha1_git_root
 
     Raises:
         BadInputExc in case of unknown algo_hash or bad hash
         NotFoundExc if either revision is not found or if sha1_git is not an
         ancestor of sha1_git_root
 
     """
     sha1_git_bin = _to_sha1_bin(sha1_git)
 
     revision = _first_element(storage.revision_get([sha1_git_bin]))
     if not revision:
         raise NotFoundExc('Revision %s not found' % sha1_git)
 
     if isinstance(sha1_git_root, str):
         sha1_git_root_bin = _to_sha1_bin(sha1_git_root)
 
         revision_root = _first_element(storage.revision_get([sha1_git_root_bin])) # noqa
         if not revision_root:
             raise NotFoundExc('Revision root %s not found' % sha1_git_root)
     else:
         sha1_git_root_bin = sha1_git_root['id']
 
     revision_log = storage.revision_log([sha1_git_root_bin], limit)
 
     parents = {}
     children = defaultdict(list)
 
     for rev in revision_log:
         rev_id = rev['id']
         parents[rev_id] = []
         for parent_id in rev['parents']:
             parents[rev_id].append(parent_id)
             children[parent_id].append(rev_id)
 
     if revision['id'] not in parents:
         raise NotFoundExc('Revision %s is not an ancestor of %s' %
                           (sha1_git, sha1_git_root))
 
     revision['children'] = children[revision['id']]
 
     return converters.from_revision(revision)
 
 
 def lookup_directory_with_revision(sha1_git, dir_path=None, with_data=False):
     """Return information on directory pointed by revision with sha1_git.
     If dir_path is not provided, display top level directory.
     Otherwise, display the directory pointed by dir_path (if it exists).
 
     Args:
         sha1_git: revision's hash.
         dir_path: optional directory pointed to by that revision.
         with_data: boolean that indicates to retrieve the raw data if the path
         resolves to a content. Default to False (for the api)
 
     Returns:
         Information on the directory pointed to by that revision.
 
     Raises:
         BadInputExc in case of unknown algo_hash or bad hash.
         NotFoundExc either if the revision is not found or the path referenced
         does not exist.
         NotImplementedError in case of dir_path exists but do not reference a
         type 'dir' or 'file'.
 
     """
     sha1_git_bin = _to_sha1_bin(sha1_git)
 
     revision = _first_element(storage.revision_get([sha1_git_bin]))
     if not revision:
         raise NotFoundExc('Revision %s not found' % sha1_git)
 
     dir_sha1_git_bin = revision['directory']
 
     if dir_path:
         paths = dir_path.strip(os.path.sep).split(os.path.sep)
         entity = storage.directory_entry_get_by_path(
             dir_sha1_git_bin, list(map(lambda p: p.encode('utf-8'), paths)))
 
         if not entity:
             raise NotFoundExc(
                 "Directory or File '%s' pointed to by revision %s not found"
                 % (dir_path, sha1_git))
     else:
         entity = {'type': 'dir', 'target': dir_sha1_git_bin}
 
     if entity['type'] == 'dir':
         directory_entries = storage.directory_ls(entity['target']) or []
         return {'type': 'dir',
                 'path': '.' if not dir_path else dir_path,
                 'revision': sha1_git,
                 'content': map(converters.from_directory_entry,
                                directory_entries)}
     elif entity['type'] == 'file':  # content
         content = storage.content_find({'sha1_git': entity['target']})
         if with_data:
             c = _first_element(storage.content_get([content['sha1']]))
             content['data'] = c['data']
         return {'type': 'file',
                 'path': '.' if not dir_path else dir_path,
                 'revision': sha1_git,
                 'content': converters.from_content(content)}
     else:
         raise NotImplementedError('Entity of type %s not implemented.'
                                   % entity['type'])
 
 
 def lookup_content(q):
     """Lookup the content designed by q.
 
     Args:
         q: The release's sha1 as hexadecimal
 
     Raises:
         NotFoundExc if the requested content is not found
 
     """
     algo, hash = query.parse_hash(q)
     c = storage.content_find({algo: hash})
     if not c:
         raise NotFoundExc('Content with %s checksum equals to %s not found!' %
                           (algo, hashutil.hash_to_hex(hash)))
     return converters.from_content(c)
 
 
 def lookup_content_raw(q):
     """Lookup the content defined by q.
 
     Args:
         q: query string of the form <hash_algo:hash>
 
     Returns:
         dict with 'sha1' and 'data' keys.
         data representing its raw data decoded.
 
     Raises:
         NotFoundExc if the requested content is not found or
         if the content bytes are not available in the storage
 
     """
     c = lookup_content(q)
     content = _first_element(storage.content_get([c['checksums']['sha1']]))
     if not content:
         algo, hash = query.parse_hash(q)
         raise NotFoundExc('Bytes of content with %s checksum equals to %s '
                           'not available in SWH storage!' %
                           (algo, hashutil.hash_to_hex(hash)))
     return converters.from_content(content)
 
 
 def stat_counters():
     """Return the stat counters for Software Heritage
 
     Returns:
         A dict mapping textual labels to integer values.
     """
     return storage.stat_counters()
 
 
 def _lookup_origin_visits(origin_id, last_visit=None, limit=10):
     """Yields the origin origin_ids' visits.
 
     Args:
         origin_id (int): origin to list visits for
         last_visit (int): last visit to lookup from
         limit (int): Number of elements max to display
 
     Yields:
        Dictionaries of origin_visit for that origin
 
     """
     limit = min(limit, MAX_LIMIT)
     yield from storage.origin_visit_get(
         origin_id, last_visit=last_visit, limit=limit)
 
 
 def lookup_origin_visits(origin_id, last_visit=None, per_page=10):
     """Yields the origin origin_ids' visits.
 
     Args:
         origin_id: origin to list visits for
 
     Yields:
        Dictionaries of origin_visit for that origin
 
     """
     visits = _lookup_origin_visits(origin_id, last_visit=last_visit,
                                    limit=per_page)
     for visit in visits:
         yield converters.from_origin_visit(visit)
 
 
 def lookup_origin_visit(origin_id, visit_id):
     """Return information about visit visit_id with origin origin_id.
 
     Args:
         origin_id: origin concerned by the visit
         visit_id: the visit identifier to lookup
 
     Yields:
        The dict origin_visit concerned
 
     """
     visit = storage.origin_visit_get_by(origin_id, visit_id)
     if not visit:
         raise NotFoundExc('Origin with id %s or its visit '
                           'with id %s not found!' % (origin_id, visit_id))
     return converters.from_origin_visit(visit)
 
 
 def lookup_snapshot(snapshot_id):
     """Return information about a snapshot, aka the list of named
     branches found during a specific visit of an origin.
 
     Args:
         snapshot_id: sha1 identifier of the snapshot
 
     Returns:
         A dict filled with the snapshot content.
     """
     snapshot_id_bin = _to_sha1_bin(snapshot_id)
     snapshot = storage.snapshot_get(snapshot_id_bin)
+    if not snapshot:
+        raise NotFoundExc('Snapshot with id %s not found!' % snapshot_id)
     return converters.from_snapshot(snapshot)
 
 
 def lookup_latest_origin_snapshot(origin_id, allowed_statuses=None):
     """Return information about the latest snapshot of an origin.
 
     Args:
         origin_id: integer identifier of the origin
         allowed_statuses: list of visit statuses considered
             to find the latest snapshot for the visit. For instance,
             ``allowed_statuses=['full']`` will only consider visits that
             have successfully run to completion.
 
     Returns:
         A dict filled with the snapshot content.
     """
     snapshot = storage.snapshot_get_latest(origin_id, allowed_statuses)
     return converters.from_snapshot(snapshot)
 
 
 def lookup_entity_by_uuid(uuid):
     """Return the entity's hierarchy from its uuid.
 
     Args:
         uuid: entity's identifier.
 
     Returns:
         List of hierarchy entities from the entity with uuid.
 
     """
     uuid = query.parse_uuid4(uuid)
     for entity in storage.entity_get(uuid):
         entity = converters.from_swh(entity,
                                      convert={'last_seen', 'uuid'},
                                      convert_fn=lambda x: str(x))
         yield entity
 
 
 def lookup_revision_through(revision, limit=100):
     """Retrieve a revision from the criterion stored in revision dictionary.
 
     Args:
         revision: Dictionary of criterion to lookup the revision with.
         Here are the supported combination of possible values:
         - origin_id, branch_name, ts, sha1_git
         - origin_id, branch_name, ts
         - sha1_git_root, sha1_git
         - sha1_git
 
     Returns:
         None if the revision is not found or the actual revision.
 
     """
     if 'origin_id' in revision and \
        'branch_name' in revision and \
        'ts' in revision and \
        'sha1_git' in revision:
         return lookup_revision_with_context_by(revision['origin_id'],
                                                revision['branch_name'],
                                                revision['ts'],
                                                revision['sha1_git'],
                                                limit)
     if 'origin_id' in revision and \
        'branch_name' in revision and \
        'ts' in revision:
         return lookup_revision_by(revision['origin_id'],
                                   revision['branch_name'],
                                   revision['ts'])
     if 'sha1_git_root' in revision and \
        'sha1_git' in revision:
         return lookup_revision_with_context(revision['sha1_git_root'],
                                             revision['sha1_git'],
                                             limit)
     if 'sha1_git' in revision:
         return lookup_revision(revision['sha1_git'])
 
     # this should not happen
     raise NotImplementedError('Should not happen!')
 
 
 def lookup_directory_through_revision(revision, path=None,
                                       limit=100, with_data=False):
     """Retrieve the directory information from the revision.
 
     Args:
         revision: dictionary of criterion representing a revision to lookup
         path: directory's path to lookup.
         limit: optional query parameter to limit the revisions log (default to
             100). For now, note that this limit could impede the transitivity
             conclusion about sha1_git not being an ancestor of.
         with_data: indicate to retrieve the content's raw data if path resolves
             to a content.
 
     Returns:
         The directory pointing to by the revision criterions at path.
 
     """
     rev = lookup_revision_through(revision, limit)
 
     if not rev:
         raise NotFoundExc('Revision with criterion %s not found!' % revision)
     return (rev['id'],
             lookup_directory_with_revision(rev['id'], path, with_data))
 
 
 def vault_cook(obj_type, obj_id, email=None):
     """Cook a vault bundle.
     """
     return vault.cook(obj_type, obj_id, email=email)
 
 
 def vault_fetch(obj_type, obj_id):
     """Fetch a vault bundle.
     """
     return vault.fetch(obj_type, obj_id)
 
 
 def vault_progress(obj_type, obj_id):
     """Get the current progress of a vault bundle.
     """
     return vault.progress(obj_type, obj_id)
 
 
 def diff_revision(rev_id):
     """Get the list of file changes (insertion / deletion / modification /
     renaming) for a particular revision.
     """
     rev_sha1_git_bin = _to_sha1_bin(rev_id)
 
     changes = storage.diff_revision(rev_sha1_git_bin, track_renaming=True)
 
     for change in changes:
         change['from'] = converters.from_directory_entry(change['from'])
         change['to'] = converters.from_directory_entry(change['to'])
         if change['from_path']:
             change['from_path'] = change['from_path'].decode('utf-8')
         if change['to_path']:
             change['to_path'] = change['to_path'].decode('utf-8')
 
     return changes
diff --git a/swh/web/static/css/style.css b/swh/web/static/css/style.css
index eccc1aa7..12b0c3a6 100644
--- a/swh/web/static/css/style.css
+++ b/swh/web/static/css/style.css
@@ -1,796 +1,799 @@
 /*
 version:   0.1
 date:      21/09/15
 author:    swh
 email:     swh
 website:   softwareheritage.org
 version history: /style.css
 */
 
 @import url(https://fonts.googleapis.com/css?family=Alegreya:400,400italic,700,700italic);
 @import url(https://fonts.googleapis.com/css?family=Alegreya+Sans:400,400italic,500,500italic,700,700italic,100,300,100italic,300italic);
 
 html {
     height: 100%;
     overflow-x: hidden;
 }
 
 body {
     font-family: 'Alegreya Sans', sans-serif;
     font-size: 1.7rem;
     line-height: 1.5;
     color: rgba(0, 0, 0, 0.55);
     padding-bottom: 120px;
     min-height: 100%;
     margin: 0;
     position: relative;
 }
 
 .heading {
     font-family: 'Alegreya', serif;
 }
 
 .shell, .text {
     font-size: 0.7em;
 }
 
 .logo img {
     max-height: 40px;
 }
 .logo .navbar-brand {
     padding: 5px;
 }
 .logo .sitename {
     padding: 15px 5px;
 }
 
 .jumbotron {
     padding: 0;
     background-color: rgba(0, 0, 0, 0);
     position: fixed;
     top: 0;
     width: 100%;
     z-index: 10;
 }
 
 #swh-navbar-collapse {
     border-top-style: none;
     border-left-style: none;
     border-right-style: none;
     border-bottom: 5px solid;
     border-image: linear-gradient(to right, rgb(226, 0, 38) 0%, rgb(254, 205, 27) 100%) 1 1 1 1;
     width: 100%;
     padding: 5px;
 }
 
 .nav-horizontal {
     float: right;
 }
 
 h3[id], h4[id], a[id] {  /* avoid in-page links covered by navbar */
     padding-top: 80px;
     margin-top: -70px;
 }
 
 h1, h2, h3, h4  {
     margin: 0;
     color: #e20026;
     padding-bottom: 10px;
 }
 h1 { font-size: 1.8em; }
 h2 { font-size: 1.2em; }
 h3 { font-size: 1.1em; }
 
 a {
     color: rgba(0, 0, 0, 0.75);
     border-bottom-style: none;
     border-bottom-width: 1px;
     border-bottom-color: rgb(91, 94, 111);
     outline: none;
 }
 
 a:hover {
     color: black;
 }
 
 ul.dropdown-menu a,
 .navbar-header a,
 ul.navbar-nav a { /* No decoration on links in dropdown menu */
     border-bottom-style: none;
     color: #323232;
     font-weight: 700;
 }
 
 .navbar-header a:hover,
 ul.navbar-nav a:hover {
     color: #8f8f8f;
 }
 
 .sitename .first-word, .sitename .second-word {
     color: rgba(0, 0, 0, 0.75);
     font-weight: normal;
     font-size: 1.8rem;
 }
 
 .sitename .first-word {
     font-family: 'Alegreya Sans', sans-serif;
 }
 
 .sitename .second-word {
     font-family: 'Alegreya', serif;
 }
 
 ul.dropdown-menu > li,
 ul.dropdown-menu > li > ul > li { /* No decoration on bullet points in dropdown menu */
     list-style-type: none;
 }
 
 .page {
     margin: 2em auto;
     width: 35em;
     border: 5px solid #ccc;
     padding: 0.8em;
     background: white;
 }
 .entries {
     list-style: none;
     margin: 0;
     padding: 0;
 }
 .entries li {
     margin: 0.8em 1.2em;
 }
 .entries li h2 {
     margin-left: -1em;
 }
 .add-entry {
     font-size: 0.9em;
     border-bottom: 1px solid #ccc;
 }
 .add-entry dl {
     font-weight: bold;
 }
 .metanav {
     text-align: right;
     font-size: 0.8em;
     padding: 0.3em;
     margin-bottom: 1em;
     background: #fafafa;
 }
 .flash {
     background: #cee5F5;
     padding: 0.5em;
     border: 1px solid #aacbe2;
 }
 .error {
     background: #f0d6d6;
     padding: 0.5em;
 }
 
 .file-found {
     color: #23BA49;
 }
 .file-notfound {
     color: #FF4747;
 }
 
 /* Bootstrap custom styling to correctly render multiple
  * form-controls in an input-group:
  *                github.com/twbs/bootstrap/issues/12732 */
 
 .input-group-field {
     display: table-cell;
     vertical-align: middle;
     border-radius:4px;
     min-width:1%;
     white-space: nowrap;
 }
 
 .input-group-field .form-control {
     border-radius: inherit !important;
 }
 
 .input-group-field:not(:first-child):not(:last-child) {
     border-radius:0;
 }
 
 .input-group-field:not(:first-child):not(:last-child) .form-control {
     border-left-width: 0;
     border-right-width: 0;
 }
 
 .input-group-field:last-child {
     border-top-left-radius:0;
     border-bottom-left-radius:0;
 }
 
 .input-group > span:not(:last-child) > button {
    border-radius: 0;
 }
 
 .multi-input-group > .input-group-btn {
   vertical-align: bottom;
   padding: 0;
 }
 
 .dataTables_filter {
     margin-top: 15px;
 }
 
 .dataTables_filter input {
     width: 70%;
     float: right;
 }
 
 tr.api-doc-route-upcoming > td, tr.api-doc-route-upcoming > td > a {
     font-size: 90%;
 }
 
 tr.api-doc-route-deprecated > td, tr.api-doc-route-deprecated > td > a {
     color: red;
 }
 
 #back-to-top {
   display: initial;
   position: fixed;
   bottom: 30px;
   right: 30px;
   z-index: 10;
 }
 
 #back-to-top a img {
   display: block;
   width: 32px;
   height: 32px;
   background-size: 32px 32px;
   text-indent: -999px;
   overflow: hidden;
 }
 
 .table > thead > tr > th {
     border-bottom: 1px solid #e20026;
 }
 
 .table > tbody > tr > td {
     border-style: none;
 }
 
 pre {
     background-color: #f5f5f5;
 }
 
 .dataTables_wrapper {
     position: static;
 }
 
 /* breadcrumbs */
 
 .bread-crumbs{
     display: inline-block;
     overflow: hidden;
     color: rgba(0, 0, 0, 0.55);
 }
 
 bread-crumbs ul {
     list-style-type: none;
 }
 
 .bread-crumbs li {
     float: left;
     list-style-type: none;
 }
 
 .bread-crumbs a {
     color: rgba(0, 0, 0, 0.75);
     border-bottom-style: none;
 }
 
 .bread-crumbs a:hover {
     color: rgba(0, 0, 0, 0.85);
     text-decoration: underline;
 }
 
 .title-small .bread-crumbs{
     margin: -30px 0 25px;
 }
 
 #footer {
     background-color: #262626;
     color: hsl(0, 0%, 100%);
     font-size: 1.2rem;
     text-align: center;
     padding-top: 20px;
     padding-bottom: 20px;
     position: absolute;
     bottom: 0;
     left: 0;
     right: 0;
 }
 #footer a,
 #footer a:visited {
     color: hsl(0, 0%, 100%);
 }
 #footer a:hover {
     text-decoration: underline;
 }
 
 .highlightjs pre {
     background-color: transparent;
     border-radius: 0px;
     border-color: transparent;
 }
 
 .hljs {
     background-color: transparent;
     white-space: pre;
 }
 
 .scrollable-menu {
     max-height: 180px;
     overflow-x: hidden;
 }
 
 .swh-browse-top-navigation {
     border-bottom: 1px solid #ddd;
     min-height: 42px;
     padding: 4px 5px 0px 5px;
 }
 
 .swh-browse-bread-crumbs {
     font-size: inherit;
     vertical-align: text-top;
     margin-bottom: 1px;
 }
 
 .swh-browse-bread-crumbs li:nth-child(n+2)::before {
     content: "";
     display: inline-block;
     margin: 0 2px;
 }
 
 .swh-metadata-table-row {
     border-top: 1px solid #ddd !important;
 }
 
 .swh-metadata-table-key {
     min-width: 200px;
     max-width: 200px;
     width: 200px;
 }
 
 .swh-metadata-table-value pre {
     white-space: pre-wrap;
 }
 
 /* for block of numbers */
 td.hljs-ln-numbers {
 	-webkit-touch-callout: none;
 	-webkit-user-select: none;
 	-khtml-user-select: none;
 	-moz-user-select: none;
 	-ms-user-select: none;
 	user-select: none;
 
 	text-align: center;
 	color: #aaa;
 	border-right: 1px solid #CCC;
 	vertical-align: top;
 	padding-right: 5px;
 
 	/* your custom style here */
 }
 
 /* for block of code */
 td.hljs-ln-code {
     padding-left: 10px;
     width: 100%;
 }
 
 .btn-swh {
     color: #6C6C6C;
     background-color: #EAEAEA;
     border-color: #ddd;
     background-image: linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);
     background-repeat: repeat-x;
     outline: none;
 }
 
 .btn-swh:hover,
 .btn-swh:focus,
 .btn-swh:active,
 .btn-swh.active,
 .open .dropdown-toggle.btn-swh {
     background-color: #e6ebf1;
     background-image: linear-gradient(to bottom,#f1f1f1 0,#e6e6e6 100%);
     border-color: rgb(197, 197, 197);
 }
 
 .btn-swh.disabled,
 .btn-swh[disabled],
 fieldset[disabled] .btn-swh,
 .btn-swh.disabled:hover,
 .btn-swh[disabled]:hover,
 fieldset[disabled] .btn-swh:hover,
 .btn-swh.disabled:focus,
 .btn-swh[disabled]:focus,
 fieldset[disabled] .btn-swh:focus,
 .btn-swh.disabled:active,
 .btn-swh[disabled]:active,
 fieldset[disabled] .btn-swh:active,
 .btn-swh.disabled.active,
 .btn-swh[disabled].active,
 fieldset[disabled] .btn-swh.active {
     background-color: #EAEAEA;
     border-color: #EAEAEA;
 }
 
 .btn-swh .badge {
     color: #EAEAEA;
     background-color: #6C6C6C;
 }
 
 .btn-swh a {
     color: #6C6C6C;
     border: none;
     outline: none;
     text-decoration: none;
 }
 
 .swh-http-error {
     margin: 0 auto;
     text-align: center;
 }
 
 .swh-http-error-head {
     color: #2d353c;
     font-size: 30px;
 }
 
 .swh-http-error-code {
     bottom: 60%;
     color: #2d353c;
     font-size: 96px;
     line-height: 80px;
     margin-bottom: 10px!important;
 }
 
 .swh-http-error-desc {
     font-size: 12px;
     color: #647788;
     text-align: center;
 }
 
 .swh-http-error-desc pre {
     display: inline-block;
     text-align: left;
     max-width: 800px;
     white-space: pre-wrap;
 }
 
 .swh-vault-table {
     border-bottom: none !important;
     margin-bottom: 0px !important;
 }
 
 .swh-vault-table td {
     vertical-align: middle !important;
     border-top: 1px solid #ddd !important;
 }
 
 .swh-counter {
     font-size: 150%;
 }
 .swh-loading {
     display : none;
 }
 
 .swh-loading.show {
     display:inline-block;
     position: fixed;
     background: white;
     border: 1px solid black;
     top: 50%;
     left: 50%;
     margin: -50px 0px 0px -50px;
     text-align: center;
     z-index:100;
 }
 
 .swh-readme a {
     outline: none;
     border: none;
 }
 
 .swh-readme table {
     border-collapse: collapse;
 }
 
 .swh-readme table,
 .swh-readme table th,
 .swh-readme table td {
     padding: 6px 13px;
     border: 1px solid #dfe2e5;
 }
 
 .swh-readme table tr:nth-child(even) {
     background-color: #f2f2f2;
 }
 
 .swh-web-app-link:hover {
     background-color: #efeff2;
 }
 
 .swh-web-app-link a {
     text-decoration: none;
     outline: none;
     border: none;
 }
 
 .popover {
     max-width: 100%;
 }
 
 .btn-swh-vault {
     border-top-right-radius: 4px !important;
     border-bottom-right-radius: 4px !important;
 }
 
 .pager a {
     outline: none;
 }
 
 .swh-content {
     background-image: none;
     border: none;
     background-color: white;
     padding: 0px;
 }
 
 .swh-content pre,
 .swh-content pre code {
     margin: 0px;
     padding: 0px;
 }
 
 .swh-visit-full {
     color: green;
     position: relative;
 }
 
 .swh-visit-full:before {
     content: "\f00c";
     font-family: FontAwesome;
     left:-20px;
     position:absolute;
     top:-2px;
  }
 
 .swh-visit-partial {
     color: #edc344;
     position: relative;
 }
 
 .swh-visit-partial:before {
     content: "\f071";
     font-family: FontAwesome;
     left:-20px;
     position:absolute;
     top:-2px;
 }
 
 .swh-visit-failed {
     color: #ff0000;
     position: relative;
 }
 
 .swh-visit-failed:before {
     content: "\f06a";
     font-family: FontAwesome;
     left:-20px;
     position:absolute;
     top:-2px;
 }
 
 .swh-visit-ongoing {
     color: #0000ff;
     position: relative;
 }
 
 .swh-visit-ongoing:before {
     content: "\f021";
     font-family: FontAwesome;
     left:-20px;
     position:absolute;
     top:-2px;
 }
 
 .swh-branches-releases {
     min-width: 200px;
 }
 
 .swh-branches-switch,
 .swh-releases-switch {
     padding: 5px 15px !important;
 }
 
 li.swh-branch:hover,
 li.swh-release:hover {
     background-color: #e8e8e8;
 }
 
 .nav a,
 .swh-branch a,
 .swh-release a {
     outline: none;
 }
 
 .swh-branch a:hover,
 .swh-release a:hover {
     text-decoration: none;
 }
 
-.swh-origin-visit-details {
+.swh-origin-visit-details,
+.swh-snapshot-details {
     text-align: center;
 }
 
-.swh-origin-visit-details ul {
+.swh-origin-visit-details ul,
+.swh-snapshot-details ul {
     list-style: none;
     margin: 0;
     padding: 0;
 }
 
-.swh-origin-visit-details li {
+.swh-origin-visit-details li,
+.swh-snapshot-details li {
     display: inline-block;
     vertical-align:  middle;
     margin-left: 10px;
     margin-right: 10px;
 }
 
 .swh-browse-nav li a {
     border-radius: 4px;
 }
 
 .swh-corner-ribbon {
     width: 200px;
     background: #e43;
     position: absolute;
     top: 25px;
     left: -50px;
     text-align: center;
     line-height: 50px;
     letter-spacing: 1px;
     color: #f0f0f0;
     transform: rotate(-45deg);
     -webkit-transform: rotate(-45deg);
     box-shadow: 0 0 3px rgba(0,0,0,.3);
     top: 25px;
     right: -50px;
     left: auto;
     transform: rotate(45deg);
     -webkit-transform: rotate(45deg);
     z-index: 2000;
 }
 
 .modal {
     text-align: center;
     padding: 0!important;
 }
 
 .modal:before {
     content: '';
     display: inline-block;
     height: 100%;
     vertical-align: middle;
     margin-right: -4px;
 }
 
 .modal-dialog {
     display: inline-block;
     text-align: left;
     vertical-align: middle;
 }
 
 .panel {
     margin-bottom: 0px;
 }
 
 .panel-group {
     margin-bottom: 0px;
 }
 
 .swh-table-even-odd tr:nth-child(even) {
     background-color: #f5f5f5;
 }
 
 .swh-table-even-odd tr:nth-child(odd) {
     background-color: #fff;
 }
 
 .swh-revision-log-entry-id {
     min-width: 100px;
     max-width: 100px;
     width: 100px;
 }
 
 .swh-revision-log-entry-author {
     min-width: 160px;
     max-width: 160px;
     width: 160px;
 }
 
 .swh-table-cell-text-overflow {
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
 }
 
 .swh-log-entry-message {
     min-width: 520px;
     max-width: 520px;
     width: 520px;
 }
 
 .swh-revision-log-entry-date {
     min-width: 220px;
     max-width: 220px;
     width: 220px;
 }
 
 .swh-directory-table {
     margin-bottom: 0px;
 }
 
 .swh-directory-table td {
     border-top: 1px solid #ddd !important;
 }
 
 .swh-title-color {
     color: #e20026;
 }
 
 .swh-diff-lines-info {
     background-color: rgba(0, 0, 255, 0.1) !important;
 }
 
 .swh-diff-added-line {
     background-color: rgba(0, 255, 0, 0.1) !important;
 }
 
 .swh-diff-removed-line {
     background-color: rgba(255, 0, 0, 0.1) !important;
 }
 
 span.no-nl-marker {
     position: relative;
     color: #cb2431;
     vertical-align: middle;
 }
 
 span.no-nl-marker svg {
     vertical-align: text-bottom;
 }
 
 span.no-nl-marker svg path {
     fill: currentColor;
 }
 
 .dropdown-submenu {
     position: relative;
 }
 
 .dropdown-submenu .dropdown-menu {
     top: 0;
     left: -100%;
     margin-top: -6px;
     margin-left: -2px;
 }
 
 a.dropdown-left:before {
     content: "\f0d9";
     font-family: FontAwesome;
     display: block;
     width: 20px;
     height: 20px;
     float: left;
     margin-left: -20px;
 }
diff --git a/swh/web/templates/branches.html b/swh/web/templates/branches.html
index 6e8051b0..ed2e9ebf 100644
--- a/swh/web/templates/branches.html
+++ b/swh/web/templates/branches.html
@@ -1,59 +1,59 @@
 {% extends "browse.html" %}
 
 {% block swh-browse-before-panels %}
-{% if origin_context %}
-  {% include "includes/origin-visit-snapshot.html" %}
+{% if snapshot_context %}
+  {% include "includes/snapshot-context.html" %}
 {% endif %}
 {% endblock %}
 
 {% block swh-browse-main-panel-content %}
 
 <div class="panel-heading">
   <div class="pull-left">
       <h2>{{ top_panel_text }}</h2>
   </div>
   <div class="clearfix"></div>
 </div>
 
 <div class="table-responsive">
   <table class="table swh-table-even-odd">
     <thead>
       <tr>
         <th><i class="fa fa-code-fork fa-fw"></i>Name</th>
         <th>Revision</th>
         <th>Message</th>
         <th>Date</th>
       </tr>
     </thead>
     <tbody>
         {% for branch in displayed_branches %}
           <tr class="swh-origin-branch">
             <td style="max-width: 300px"><i class="fa fa-code-fork fa-fw"></i><a href="{{ branch.directory_url }}">{{ branch.name }}</a></td>
             <td><a href="{{ branch.revision_url }}">{{ branch.revision|slice:":7" }}</a></td>
             <td class="swh-log-entry-message swh-table-cell-text-overflow" style="min-width: 500px" title="{{ branch.message }}">{{ branch.message }}</td>
             <td style="min-width: 250px">{{ branch.date }}</td
           </tr>
         {% endfor %}
     </tbody>
   </table>
 </div>
 {% endblock %}
 
 {% block swh-browse-after-panels %}
 
 {% if prev_branches_url or next_branches_url %}
   <ul class="pager">
       {% if prev_branches_url %}
         <li><a href="{{ prev_branches_url }}">Previous</a></li>
       {% else %}
         <li class="disabled"><a>Older</a></li>
       {% endif %}
       {% if next_branches_url %}
         <li><a href="{{ next_branches_url }}">Next</a></li>
       {% else %}
         <li class="disabled"><a>Newer</a></li>
       {% endif %}
   </ul>
 {% endif %}
 
 {% endblock %}
diff --git a/swh/web/templates/content.html b/swh/web/templates/content.html
index 60f67370..da18d3e3 100644
--- a/swh/web/templates/content.html
+++ b/swh/web/templates/content.html
@@ -1,19 +1,19 @@
 {% extends "browse.html" %}
 
 {% block header %}
   {% include "includes/content-scripts.html" %}
 {% endblock %}
 
 {% block swh-browse-before-panels %}
-  {% if origin_context %}
-    {% include "includes/origin-visit-snapshot.html" %}
+  {% if snapshot_context %}
+    {% include "includes/snapshot-context.html" %}
   {% endif %}
 {% endblock %}
 
 {% block swh-browse-main-panel-content %}
 
 {% include "includes/top-navigation.html" %}
 
 {% include "includes/content-display.html" %}
 
 {% endblock %}
diff --git a/swh/web/templates/directory.html b/swh/web/templates/directory.html
index fd567c9a..88a108f3 100644
--- a/swh/web/templates/directory.html
+++ b/swh/web/templates/directory.html
@@ -1,21 +1,21 @@
 {% extends "browse.html" %}
 
 {% block swh-browse-before-panels %}
-{% if origin_context %}
-  {% include "includes/origin-visit-snapshot.html" %}
+{% if snapshot_context %}
+  {% include "includes/snapshot-context.html" %}
 {% endif %}
 {% endblock %}
 
 {% block swh-browse-main-panel-content %}
 
 {% include "includes/top-navigation.html" %}
 
 {% include "includes/directory-display.html" %}
 
 {% endblock %}
 
 {% block swh-browse-panels-group-end %}
 
 {% include "includes/readme-display.html" %}
 
 {% endblock %}
diff --git a/swh/web/templates/includes/origin-visit-snapshot.html b/swh/web/templates/includes/origin-visit-snapshot.html
deleted file mode 100644
index ac04f1ed..00000000
--- a/swh/web/templates/includes/origin-visit-snapshot.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<div class="panel panel-default" style="overflow-x: auto;">
-  <div class="panel-heading">
-    {% if origin_context.origin_info.url|slice:"0:4" == "http" %}
-      <div class="pull-right">
-        <a href="{{ origin_context.origin_info.url }}" class="btn btn-md btn-swh" role="button">Go to origin</a>
-      </div>
-    {% endif %}
-    <a href="{{ origin_context.origin_browse_url }}" style="outline:none;">
-      <h2 style="text-align: center">SWH origin: {{ origin_context.origin_info.url }}</h2>
-      <div class="clearfix"></div>
-    </a>
-  </div>
-  <div class="swh-origin-visit-details">
-    <ul>
-      <li><i class="fa fa-calendar fa-fw"></i> SWH visit date: <a href="{{ origin_context.origin_visit_url }}">{{ origin_context.visit_info.fmt_date }}</a></li>
-      <li><i class="fa fa-code-fork fa-fw"></i> <a href="{{ origin_context.origin_branches_url }}">Branches ({{ origin_context.branches|length}})</a></li>
-      {% if origin_context.releases %}
-        <li><i class="fa fa-tag fa-fw"></i> <a href="{{ origin_context.origin_releases_url }}">Releases ({{ origin_context.releases|length }})</a></li>
-      {% else %}
-        <li><i class="fa fa-tag fa-fw"></i> Releases (0)</li>
-      {% endif %}
-    </ul>
-  </div>
-</div>
diff --git a/swh/web/templates/includes/snapshot-context.html b/swh/web/templates/includes/snapshot-context.html
new file mode 100644
index 00000000..a67a4ce6
--- /dev/null
+++ b/swh/web/templates/includes/snapshot-context.html
@@ -0,0 +1,33 @@
+<div class="panel panel-default" style="overflow-x: auto;">
+  <div class="panel-heading">
+    {% if snapshot_context.origin_info %}
+      {% if snapshot_context.origin_info.url|slice:"0:4" == "http" %}
+        <div class="pull-right">
+          <a href="{{ snapshot_context.origin_info.url }}" class="btn btn-md btn-swh" role="button">Go to origin</a>
+        </div>
+      {% endif %}
+      <a href="{{ snapshot_context.browse_url }}" style="outline:none;">
+        <h2 style="text-align: center">SWH origin: {{ snapshot_context.origin_info.url }}</h2>
+        <div class="clearfix"></div>
+      </a>
+    {% else %}
+    <a href="{{ snapshot_context.browse_url }}" style="outline:none;">
+      <h2 style="text-align: center">SWH snapshot: {{ snapshot_context.snapshot_id }}</h2>
+      <div class="clearfix"></div>
+    </a>
+    {% endif %}
+  </div>
+  <div class="swh-origin-visit-details">
+    <ul>
+      {% if snapshot_context.visit_info %}
+        <li><i class="fa fa-calendar fa-fw"></i> SWH visit date: <a href="{{ snapshot_context.visit_info.url }}">{{ snapshot_context.visit_info.fmt_date }}</a></li>
+      {% endif %}
+      <li><i class="fa fa-code-fork fa-fw"></i> <a href="{{ snapshot_context.branches_url }}">Branches ({{ snapshot_context.branches|length}})</a></li>
+      {% if snapshot_context.releases %}
+        <li><i class="fa fa-tag fa-fw"></i> <a href="{{ snapshot_context.releases_url }}">Releases ({{ snapshot_context.releases|length }})</a></li>
+      {% else %}
+        <li><i class="fa fa-tag fa-fw"></i> Releases (0)</li>
+      {% endif %}
+    </ul>
+  </div>
+</div>
diff --git a/swh/web/templates/includes/top-navigation.html b/swh/web/templates/includes/top-navigation.html
index 51d57a05..196091c4 100644
--- a/swh/web/templates/includes/top-navigation.html
+++ b/swh/web/templates/includes/top-navigation.html
@@ -1,138 +1,138 @@
 {% load swh_templatetags %}
 
 <div class="swh-browse-top-navigation">
-  {% if origin_context %}
-    {% if origin_context.branch or origin_context.release %}
+  {% if snapshot_context %}
+    {% if snapshot_context.branch or snapshot_context.release %}
       <div class="dropdown" style="float: left;" id="swh-branches-releases-dd">
         <button class="btn btn-md btn-swh dropdown-toggle" type="button" data-toggle="dropdown">
-          {% if origin_context.branch %}
+          {% if snapshot_context.branch %}
             <i class="fa fa-code-fork fa-fw" aria-hidden="true"></i>
-            Branch: <strong>{{ origin_context.branch }}</strong>
+            Branch: <strong>{{ snapshot_context.branch }}</strong>
           {% else %}
             <i class="fa fa-tag fa-fw" aria-hidden="true"></i>
-            Release: <strong>{{ origin_context.release }}</strong>
+            Release: <strong>{{ snapshot_context.release }}</strong>
           {% endif %}
           <span class="caret"></span>
         </button>
         <ul class="scrollable-menu dropdown-menu swh-branches-releases">
           <div class="tabbable tabs-top">
             <ul class="nav nav-tabs">
               <li class="active"><a class="swh-branches-switch" data-toggle="tab">Branches</a></li>
               <li><a class="swh-releases-switch" data-toggle="tab">Releases</a></li>
             </ul>
             <div class="tab-content">
               <div class="tab-pane active" id="swh-tab-branches">
-                {% for b in origin_context.branches %}
+                {% for b in snapshot_context.branches %}
                   <li class="swh-branch">
                     <a href="{{ b.url | safe }}">
                       <i class="fa fa-code-fork fa-fw" aria-hidden="true"></i>
-                      {% if b.name == origin_context.branch %}
+                      {% if b.name == snapshot_context.branch %}
                         <i class="fa fa-check fa-fw" aria-hidden="true"></i>
                       {% else %}
                         <i class="fa fa-fw" aria-hidden="true"></i>
                       {% endif %}
                       {{ b.name }}
                     </a>
                   </li>
                 {% endfor %}
               </div>
               <div class="tab-pane" id="swh-tab-releases">
-                {% if origin_context.releases %}
-                  {% for r in origin_context.releases %}
+                {% if snapshot_context.releases %}
+                  {% for r in snapshot_context.releases %}
                     {% if r.target_type == 'revision' %}
                       <li class="swh-release">
                         <a href="{{ r.url | safe }}">
                           <i class="fa fa-tag fa-fw" aria-hidden="true"></i>
-                          {% if r.name == origin_context.release %}
+                          {% if r.name == snapshot_context.release %}
                             <i class="fa fa-check fa-fw" aria-hidden="true"></i>
                           {% else %}
                             <i class="fa fa-fw" aria-hidden="true"></i>
                           {% endif %}
                           {{ r.name }}
                         </a>
                       </li>
                     {% endif %}
                   {% endfor %}
                 {% else %}
                   <span>No releases to show</span>
                 {% endif %}
               </div>
             </div>
           </div>
         </ul>
       </div>
     {% endif %}
   {% endif %}
 
   <div class="btn-group pull-right">
     {% if top_right_link %}
       <a href="{{ top_right_link | safe }}" class="btn btn-md btn-swh" role="button">{{ top_right_link_text }}</a>
     {% endif %}
     {% if show_actions_menu %}
       <button class="btn btn-md btn-swh dropdown-toggle" type="button" data-toggle="dropdown">
         <i class="fa fa-bars fa-fw" aria-hidden="true"></i>Actions
         <span class="caret"></span>
       </button>
       <ul class="dropdown-menu swh-browse-actions-menu">
         {% include "includes/vault-create-tasks.html" %}
       </ul>
     {% endif %}
   </div>
 
   {% include "includes/breadcrumbs.html" %}
 
 </div>
 
 <script>
 
   function setBranchesTabActive() {
     $('.swh-releases-switch').parent().removeClass('active');
     $('.swh-branches-switch').parent().addClass('active');
     $('#swh-tab-releases').removeClass('active');
     $('#swh-tab-branches').addClass('active');
   }
 
   function setReleasesTabActive() {
     $('.swh-branches-switch').parent().removeClass('active');
     $('.swh-releases-switch').parent().addClass('active');
     $('#swh-tab-branches').removeClass('active');
     $('#swh-tab-releases').addClass('active');
   }
 
   $('.dropdown-menu a.swh-branches-switch').click(function(e) {
     setBranchesTabActive();
     e.stopPropagation();
   });
 
   $('.dropdown-menu a.swh-releases-switch').click(function(e) {
     setReleasesTabActive();
     e.stopPropagation();
   });
 
   var dd_resized = false;
 
   // hack to resize the branches/releases dropdown content,
   // taking icons into account, in order to make the whole names readable
   $('#swh-branches-releases-dd').on('show.bs.dropdown', function () {
     if (dd_resized) return;
     var dd_width = $('.swh-branches-releases').width();
     $('.swh-branches-releases').width(dd_width + 25);
     dd_resized = true;
   })
 
   $(document).ready(function() {
-    {% if origin_context %}
-      if ('{{ origin_context.branch }}' != 'None') {
+    {% if snapshot_context %}
+      if ('{{ snapshot_context.branch }}' != 'None') {
         setBranchesTabActive();
       } else {
         setReleasesTabActive();
       }
     {% endif %}
     $('.dropdown-submenu a.dropdown-link').on("click", function(e){
       $(this).next('ul').toggle();
       e.stopPropagation();
       e.preventDefault();
     });
   });
 
 </script>
diff --git a/swh/web/templates/release.html b/swh/web/templates/release.html
index 9fe55f0c..01ed5da4 100644
--- a/swh/web/templates/release.html
+++ b/swh/web/templates/release.html
@@ -1,20 +1,20 @@
 {% extends "browse.html" %}
 {% load swh_templatetags %}
 
 {% block swh-browse-before-panels %}
-{% if origin_context %}
-  {% include "includes/origin-visit-snapshot.html" %}
+{% if snapshot_context %}
+  {% include "includes/snapshot-context.html" %}
 {% endif %}
 {% endblock %}
 
 {% block swh-browse-main-panel-content %}
 <div style="height: 35px;margin: 4px;">
 <i class="fa fa-tag fa-fw"></i>Release <b>{{ swh_object_metadata.name }}</b> created by {{ swh_object_metadata.author }} on <b>{{ swh_object_metadata.date }}</b>
 </div>
 <pre style="white-space: pre-wrap">
 <h2>{{ release_note_header }}</h2>{{ release_note_body }}
 </pre>
 <div style="margin: 4px;">
 {{ release_target_link }}
 </div>
 {% endblock %}
\ No newline at end of file
diff --git a/swh/web/templates/releases.html b/swh/web/templates/releases.html
index d1f93ced..8a343ba9 100644
--- a/swh/web/templates/releases.html
+++ b/swh/web/templates/releases.html
@@ -1,59 +1,59 @@
 {% extends "browse.html" %}
 
 {% block swh-browse-before-panels %}
-{% if origin_context %}
-  {% include "includes/origin-visit-snapshot.html" %}
+{% if snapshot_context %}
+  {% include "includes/snapshot-context.html" %}
 {% endif %}
 {% endblock %}
 
 {% block swh-browse-main-panel-content %}
 
 <div class="panel-heading">
   <div class="pull-left">
       <h2>{{ top_panel_text }}</h2>
   </div>
   <div class="clearfix"></div>
 </div>
 
 <div class="table-responsive">
   <table class="table swh-table-even-odd">
     <thead>
       <tr>
         <th><i class="fa fa-tag fa-fw"></i>Name</th>
-        <th>Type</th>
+        <th>Target</th>
         <th>Message</th>
         <th>Date</th>
       </tr>
     </thead>
     <tbody>
         {% for release in displayed_releases %}
           <tr class="swh-origin-release">
             <td><i class="fa fa-tag fa-fw"></i><a href="{{ release.release_url }}">{{ release.name }}</a></td>
             <td>{{ release.target_type }}</td>
             <td class="swh-log-entry-message swh-table-cell-text-overflow" title="{{ release.message }}">{{ release.message }}</td>
             <td>{{ release.date }}</td
           </tr>
         {% endfor %}
     </tbody>
   </table>
 </div>
 {% endblock %}
 
 {% block swh-browse-after-panels %}
 
 {% if prev_releases_url or next_releases_url %}
   <ul class="pager">
       {% if prev_releases_url %}
         <li><a href="{{ prev_releases_url }}">Previous</a></li>
       {% else %}
         <li class="disabled"><a>Older</a></li>
       {% endif %}
       {% if next_releases_url %}
         <li><a href="{{ next_releases_url }}">Next</a></li>
       {% else %}
         <li class="disabled"><a>Newer</a></li>
       {% endif %}
   </ul>
 {% endif %}
 
 {% endblock %}
diff --git a/swh/web/templates/revision-log.html b/swh/web/templates/revision-log.html
index aa5c010d..f5b6ea49 100644
--- a/swh/web/templates/revision-log.html
+++ b/swh/web/templates/revision-log.html
@@ -1,60 +1,63 @@
 {% extends "browse.html" %}
 
 {% block swh-browse-before-panels %}
-{% if origin_context %}
-  {% include "includes/origin-visit-snapshot.html" %}
+{% if snapshot_context %}
+  {% include "includes/snapshot-context.html" %}
 {% endif %}
 {% endblock %}
 
 {% block swh-browse-main-panel-content %}
-{% if not origin_context %}
+
+{% include "includes/top-navigation.html" %}
+
+{% if not snapshot_context %}
 <div class="panel-heading">
   <div class="panel-title pull-left">
     <h2>{{ top_panel_text }}</h2>
   </div>
   <div class="clearfix"></div>
 </div>
 {% endif %}
 
 <div class="table-responsive">
   <table class="table swh-table-even-odd">
     <thead>
       <tr>
         <th><i class="octicon octicon-git-commit fa-fw"></i>Revision</th>
         <th>Author</th>
         <th>Message</th>
         <th>Date</th>
         <th></th>
       </tr>
     </thead>
     <tbody>
         {% for log in revision_log %}
           <tr class="swh-revision-log-entry">
             <td class="swh-revision-log-entry-id"><i class="octicon octicon-git-commit fa-fw"></i>{{ log.revision }}</td>
             <td class="swh-revision-log-entry-author">{{ log.author }}</td>
             <td class="swh-log-entry-message swh-table-cell-text-overflow" title="{{ log.message }}">{{ log.message }}</td>
             <td class="swh-revision-log-entry-date">{{ log.date }}</td>
             <td>{{ log.directory }}</td>
           </tr>
         {% endfor %}
     </tbody>
   </table>
 </div>
 {% endblock %}
 
 {% block swh-browse-after-panels %}
 
 <ul class="pager">
     {% if next_log_url %}
       <li><a href="{{ next_log_url }}">Newer</a></li>
     {% else %}
       <li class="disabled"><a>Newer</a></li>
     {% endif %}
     {% if prev_log_url %}
       <li><a href="{{ prev_log_url }}">Older</a></li>
     {% else %}
       <li class="disabled"><a>Older</a></li>
     {% endif %}
 </ul>
 
 {% endblock %}
diff --git a/swh/web/templates/revision.html b/swh/web/templates/revision.html
index f0002c9b..7acd62eb 100644
--- a/swh/web/templates/revision.html
+++ b/swh/web/templates/revision.html
@@ -1,615 +1,615 @@
 {% extends "browse.html" %}
 {% load static %}
 
 {% block header %}
   {% include "includes/content-scripts.html" %}
   <script src="{% static 'js/jquery-waypoints/jquery.waypoints.min.js' %}"></script>
 {% endblock %}
 
 {% block swh-browse-before-panels %}
-{% if origin_context %}
-  {% include "includes/origin-visit-snapshot.html" %}
+{% if snapshot_context %}
+  {% include "includes/snapshot-context.html" %}
 {% endif %}
 {% endblock %}
 
 {% block swh-browse-main-panel-content %}
 <div style="height: 35px;margin: 4px;">
 <i class="octicon octicon-git-commit fa-fw"></i>Revision <b>{{ swh_object_metadata.id }}</b>
 authored by {{ swh_object_metadata.author }} on <b>{{ swh_object_metadata.date }}</b>
 </div>
 
 <div class="panel panel-default" style="overflow-x: auto;">
   <div class="panel-heading" style="padding: 10px">
     <a data-toggle="collapse" id="swh-collapse-revision-message" href="#swh-revision-message">
       <div class="pull-left">
         <pre style="white-space: pre-wrap; background-color: inherit; padding: 0px; margin: 0px; border: none;"><h2 style="padding-bottom: 0px;">{{ message_header }}</h2></pre>
       </div>
       <div class="clearfix"></div>
     </a>
   </div>
 
   <div id="swh-revision-message" class="panel-collapse collapse">
     <pre style="white-space: pre-wrap; margin: 0px; border: none; border-radius: 0px;">{{ message_body }}</pre>
   </div>
 </div>
 
 <div style="margin: 4px; padding-bottom: 5px;">
 {{ parents_links }}
 </div>
 
 <ul class="nav nav-tabs" style="padding-left: 5px;">
   <li class="active"><a data-toggle="tab" href="#swh-revision-tree">Files</a></li>
   <li><a data-toggle="tab" href="#swh-revision-changes">Changes</a></li>
 </ul>
 
 <div class="tab-content">
   <div id="swh-revision-tree" class="tab-pane active">
 
     {% include "includes/top-navigation.html" %}
 
     {% if content_size %}
 
     {% include "includes/content-display.html" %}
 
     {% else %}
 
     {% include "includes/directory-display.html" %}
 
     {% endif %}
   </div>
   <div id="swh-revision-changes" class="tab-pane">
 
     <div id="swh-too-large-revision-diff" class="alert alert-warning" role="alert" style="display: none; margin: 5px 5px 0px 5px">
       The diff you're trying to view is too large. Only the first <span id="swh-nb-loaded-diffs">1000</span> changed files have been loaded.
     </div>
 
     <div id="swh-revision-diffs" class="panel-group" style="padding: 5px;">
 
       <div class="panel panel-default" style="overflow-x: auto;">
         <div class="panel-heading">
           <a data-toggle="collapse" href="#swh-revision-changes-list">
             <div class="pull-left">
               Showing <strong id="swh-revision-changed-files"></strong>
               with <strong id="swh-revision-lines-added" style="color:green">0 additions</strong>
               and <strong id="swh-revision-lines-deleted" style="color:red">0 deletions</strong>
               (<span id="swh-nb-diffs-computed">0</span> / <span id="swh-total-nb-diffs">0</span> diffs computed)
             </div>
             <div class="pull-right">
               <button class="btn btn-md btn-swh" type="button" onclick="compute_all_diffs(event)" id="swh-compute-all-diffs"
                       title="By default, diffs will be computed as the view is scrolled.
 Pushing that button will request the immediate computation of all diffs." style="visibility: hidden;">Compute all diffs</button>
             </div>
             <div class="clearfix"></div>
           </a>
         </div>
         <div id="swh-revision-changes-list" class="panel-collapse collapse in">
           <div id="swh-revision-changes-loading" style="text-align: center">
             <img src="{% static "img/swh-spinner.gif" %}"></img>
             <p>Computing file changes ...</p>
           </div>
           <pre style="background: none; border: none;display: none;"></pre>
         </div>
       </div>
   </div>
 
 </div>
 
 <script>
 
   // number of changed files in the revision
   var changes = null;
   var nb_changed_files = 0;
   // to track the number of already computed files diffs
   var nb_diffs_computed = 0;
 
   // the no newline at end of file marker from Github
   var no_nl_marker = '<span class="no-nl-marker" title="No newline at end of file">' +
                      '<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">' +
                      '  <path fill-rule="evenodd" d="M16 5v3c0 .55-.45 1-1 1h-3v2L9 8l3-3v2h2V5h2zM8 8c0 2.2-1.8 4-4 4s-4-1.8-4-4 1.8-4 4-4 4 1.8 4 4zM1.5 9.66L5.66 5.5C5.18 5.19 4.61 5 4 5 2.34 5 1 6.34 1 8c0 .61.19 1.17.5 1.66zM7 8c0-.61-.19-1.17-.5-1.66L2.34 10.5c.48.31 1.05.5 1.66.5 1.66 0 3-1.34 3-3z"></path>' +
                      '</svg>' +
                      '</span>';
 
   // to track the total number of added lines in files diffs
   var nb_additions = 0;
   // to track the total number of deleted lines in files diffs
   var nb_deletions = 0;
   // to track the already computed diffs by id
   var computed_diffs = {};
   // map a diff id to its computation url
   var diffs_urls = {};
 
   // to check if a DOM element is in the viewport
   function is_in_viewport(elt) {
     var elementTop = $(elt).offset().top;
     var elementBottom = elementTop + $(elt).outerHeight();
 
     var viewportTop = $(window).scrollTop();
     var viewportBottom = viewportTop + $(window).height();
 
     return elementBottom > viewportTop && elementTop < viewportBottom;
   }
 
   // to format the diffs line numbers
   function format_ln_diff(from_line, to_line, max_number_chars) {
     var ret = '';
     if (from_line != null) {
       for (var i = 0 ; i < (max_number_chars - from_line.length); ++i) {
         ret += ' ';
       }
       ret += from_line;
     }
     if (from_line != null && to_line != null) {
       ret += '  ';
     }
     if (to_line != null) {
       for (var i = 0 ; i < (max_number_chars - to_line.length); ++i) {
         ret += ' ';
       }
       ret += to_line;
     }
     return ret;
   }
 
   // callback to switch from side-by-side diff to unified one
   function show_unified_diff(event, diff_id) {
     $('#' + diff_id + '-splitted-diff').css('display', 'none');
     $('#' + diff_id + '-unified-diff').css('display', 'block');
     $(event.target).parent().find('.splitted-diff-button').removeClass('active');
     $(event.target).parent().find('.unified-diff-button').addClass('active');
   }
 
   // callback to switch from unified diff to side-by-side one
   function show_splitted_diff(event, diff_id) {
     $('#' + diff_id + '-unified-diff').css('display', 'none');
     $('#' + diff_id + '-splitted-diff').css('display', 'block');
     $(event.target).parent().find('.unified-diff-button').removeClass('active');
     $(event.target).parent().find('.splitted-diff-button').addClass('active');
   }
 
   // to compute diff and process it for display
   function compute_diff(diff_url, diff_id) {
 
     // force diff computation ?
     var force = diff_url.indexOf('force=true') != -1;
 
     // it no forced computation and diff already computed, do nothing
     if (!force && computed_diffs.hasOwnProperty(diff_id)) {
       return;
     }
 
     // mark diff computation as already requested
     computed_diffs[diff_id] = true;
 
     $('#' + diff_id + '-loading').css('visibility', 'visible');
 
     // set spinner visible while requesting diff
     $('#' + diff_id + '-loading').css('display', 'block');
     $('#' + diff_id + '-highlightjs').css('display', 'none');
 
     // request diff computation and process it
     $.ajax({
       url: diff_url,
       dataType: 'json',
       success: function (data) {
 
         // increment number of computed diffs
         ++nb_diffs_computed;
         // toggle the 'Compute all diffs' button if all diffs have been computed
         if (nb_diffs_computed == changes.length) {
           $('#swh-compute-all-diffs').addClass('active');
         }
 
         // Large diff (> threshold) are not automatically computed,
         // add a button to force its computation
         if (data.diff_str.indexOf('Large diff') == 0) {
           $('#' + diff_id)[0].innerHTML = data.diff_str +
             '<br/><button class="btn btn-md btn-swh" type="button" onclick="compute_diff(\'' +
             diff_url + '&force=true\', \'' + diff_id + '\')">Request diff</button>';
             set_diff_visible(diff_id);
         } else {
 
           // prepare code highlighting
           $('.' + diff_id).removeClass('nohighlight-swh');
           $('.' + diff_id).addClass(data.language);
 
           // set unified diff text
           $('#' + diff_id).text(data.diff_str);
 
           // code highlighting for unified diff
           $('#' + diff_id).each(function(i, block) {
             hljs.highlightBlock(block);
             hljs.lineNumbersBlock(block);
           });
 
           // hljs.lineNumbersBlock is asynchronous so we have to postpone our
           // next treatments by adding it at the end of the current js events queue
           setTimeout(function() {
 
             // process unified diff lines in order to generate side-by-side diffs text
             // but also compute line numbers for unified and side-by-side difss
             var lines_info_regexp = new RegExp(/^@@ -(\d+),(\d+) \+(\d+),(\d+) @@$/gm);
             var base_from_line = '';
             var base_to_line = '';
             var from_to_lines = [];
             var from_lines = [];
             var to_lines = [];
             var max_number_chars = 0;
             var diff_from_str = '';
             var diff_to_str = '';
             var lines_offset = 0;
 
             $('#' + diff_id + ' .hljs-ln-numbers').each(function(i, ln_elt) {
               var ln_text = ln_elt.nextSibling.innerText;
               var lines_info = lines_info_regexp.exec(ln_text);
               var from_line = '';
               var to_line = '';
               // parsed lines info from the diff output
               if (lines_info) {
                 base_from_line = parseInt(lines_info[1]) - 1;
                 base_to_line = parseInt(lines_info[3]) - 1;
                 lines_offset = 0;
                 diff_from_str += (ln_text + '\n');
                 diff_to_str += (ln_text + '\n');
                 from_lines.push('');
                 to_lines.push('');
               // line removed in the from file
               } else if (ln_text.length > 0 && ln_text[0] == '-') {
                 base_from_line = base_from_line + 1;
                 from_line = base_from_line.toString();
                 from_lines.push(from_line);
                 ++nb_deletions;
                 diff_from_str += (ln_text + '\n');
                 ++lines_offset;
               // line added in the from file
               } else if (ln_text.length > 0 && ln_text[0] == '+') {
                 base_to_line = base_to_line + 1;
                 to_line = base_to_line.toString();
                 to_lines.push(to_line);
                 ++nb_additions;
                 diff_to_str += (ln_text + '\n');
                 --lines_offset;
               // line present in both files
               } else {
                 base_from_line = base_from_line + 1;
                 base_to_line = base_to_line + 1;
                 from_line = base_from_line.toString();
                 to_line = base_to_line.toString();
                 for (var j = 0 ; j < Math.abs(lines_offset) ; ++j) {
                   if (lines_offset > 0) {
                     diff_to_str += '\n';
                     to_lines.push('');
                   } else {
                     diff_from_str += '\n';
                     from_lines.push('');
                   }
                 }
                 lines_offset = 0;
                 diff_from_str += (ln_text + '\n');
                 diff_to_str += (ln_text + '\n');
                 to_lines.push(to_line);
                 from_lines.push(from_line);
               }
               if (!base_from_line) {
                 from_line = '';
               }
               if (!base_to_line) {
                 to_line = '';
               }
               from_to_lines[i] = [from_line, to_line];
               max_number_chars = Math.max(max_number_chars, from_line.length);
               max_number_chars = Math.max(max_number_chars, to_line.length);
             });
 
             // set side-by-side diffs text
             $('#' + diff_id + '-from').text(diff_from_str);
             $('#' + diff_id + '-to').text(diff_to_str);
 
             // code highlighting for side-by-side diffs
             $('#' + diff_id + '-from, #' + diff_id + '-to').each(function(i, block) {
               hljs.highlightBlock(block);
               hljs.lineNumbersBlock(block);
             });
 
             // hljs.lineNumbersBlock is asynchronous so we have to postpone our
             // next treatments by adding it at the end of the current js events queue
             setTimeout(function() {
               // diff highlighting for added/removed lines on top of code highlighting
               $('.' + diff_id + ' .hljs-ln-numbers').each(function(i, ln_elt) {
                 var ln_text = ln_elt.nextSibling.innerText;
                 var lines_info = lines_info_regexp.exec(ln_text);
                 if (lines_info) {
                   $(ln_elt).parent().addClass('swh-diff-lines-info');
                   var lines_info_text = $(ln_elt).parent().find('.hljs-ln-code .hljs-ln-line').text();
                   $(ln_elt).parent().find('.hljs-ln-code .hljs-ln-line').children().remove();
                   $(ln_elt).parent().find('.hljs-ln-code .hljs-ln-line').text('');
                   $(ln_elt).parent().find('.hljs-ln-code .hljs-ln-line').append('<span class="hljs-meta">' + lines_info_text + '</span>');
                 } else if (ln_text.length > 0 && ln_text[0] == '-') {
                   $(ln_elt).parent().addClass('swh-diff-removed-line');
                 } else if (ln_text.length > 0 && ln_text[0] == '+') {
                   $(ln_elt).parent().addClass('swh-diff-added-line');
                 }
               });
 
 
               // set line numbers for unified diff
               $('#' + diff_id + ' .hljs-ln-numbers').each(function(i, ln_elt) {
                 $(ln_elt).children().attr('data-line-number',
                                           format_ln_diff(from_to_lines[i][0], from_to_lines[i][1],
                                           max_number_chars));
               });
 
               // set line numbers for the from side-by-side diff
               $('#' + diff_id + '-from .hljs-ln-numbers').each(function(i, ln_elt) {
                 $(ln_elt).children().attr('data-line-number',
                                           format_ln_diff(from_lines[i], null,
                                           max_number_chars));
               });
 
               // set line numbers for the to side-by-side diff
               $('#' + diff_id + '-to .hljs-ln-numbers').each(function(i, ln_elt) {
                 $(ln_elt).children().attr('data-line-number',
                                           format_ln_diff(null, to_lines[i],
                                           max_number_chars));
               });
 
               // last processings:
               //  - remove the '+' and '-' at the beginning of the diff lines
               //    from code highlighting
               //  - add the "no new line at end of file marker" if needed
               $('.' + diff_id + ' .hljs-ln-line').each(function(i, ln_elt) {
                 if (ln_elt.firstChild) {
                   if (ln_elt.firstChild.nodeName != "#text") {
                     var line_text = ln_elt.firstChild.innerHTML;
                     if (line_text[0] == '-' || line_text[0] == '+') {
                       ln_elt.firstChild.innerHTML = line_text.substr(1);
                       var new_text_node = document.createTextNode(line_text[0]);
                       $(ln_elt).prepend(new_text_node);
                     }
                   }
                   $(ln_elt).contents().filter(function() {
                     return this.nodeType === 3; //Node.TEXT_NODE
                   }).each(function(i, textNode) {
                     var swh_no_nl_marker = '[swh-no-nl-marker]';
                     if (textNode.textContent.indexOf(swh_no_nl_marker) != -1) {
                       textNode.textContent = textNode.textContent.replace(swh_no_nl_marker, '');
                       $(ln_elt).append($(no_nl_marker));
                     }
                   });
                 }
               });
 
               // remove empty last line added by highlight.js
               $('#' + diff_id + ' tr:last').remove();
               $('#' + diff_id + '-from tr:last').remove();
               $('#' + diff_id + '-to tr:last').remove();
               $('#' + diff_id + '-from tr:last').remove();
               $('#' + diff_id + '-to tr:last').remove();
 
               // hide the diff mode switch button in case of not generated diffs
               if (data.diff_str.indexOf('Diffs are not generated for non textual content') != 0) {
                 $('#panel_' + diff_id + ' .diff-styles').css('visibility', 'visible');
               }
 
               set_diff_visible(diff_id);
 
             });
           });
         }
       }
     });
   }
 
   function set_diff_visible(diff_id) {
     // set the unified diff visible by default
     $('#' + diff_id + '-loading').css('display', 'none');
     $('#' + diff_id + '-highlightjs').css('display', 'block');
 
     // update displayed counters
     $('#swh-revision-lines-added').text(nb_additions + ' additions');
     $('#swh-revision-lines-deleted').text(nb_deletions + ' deletions');
     $('#swh-nb-diffs-computed').text(nb_diffs_computed);
 
     // refresh the waypoints triggering diffs computation as
     // the DOM layout has been updated
     Waypoint.refreshAll();
   }
 
   // to compute all visible diffs in the viewport
   function compute_visible_diffs() {
     $('.swh-file-diff-panel').each(function(i, elt) {
       if (is_in_viewport(elt)) {
         diff_id = elt.id.replace('panel_', '');
         compute_diff(diffs_urls[diff_id], diff_id);
       }
     });
   }
 
   // callback when the user clicks on the 'Compute all diffs' button
   function compute_all_diffs(event) {
     $(event.target).addClass('active');
     for (var diff_id in diffs_urls) {
       if (diffs_urls.hasOwnProperty(diff_id)) {
         compute_diff(diffs_urls[diff_id], diff_id);
       }
     }
     event.stopPropagation();
   }
 
   function gen_diff_panel(diff_data) {
     var diff_panel_title = diff_data.path;
     if (diff_data.type == 'rename') {
       diff_panel_title = diff_data.from_path + ' &rarr; ' + diff_data.to_path;
     }
     var diff_panel_html =
     '<div id="panel_' + diff_data.id + '" class="panel panel-default swh-file-diff-panel" style="overflow-x: auto;"> \
       <div class="panel-heading"> \
         <a data-toggle="collapse" href="#panel_' + diff_data.id + '_content"> \
           <div class="pull-left swh-title-color"> \
             <strong>' + diff_panel_title + '</strong> \
           </div> \
         </a> \
         <div class="pull-right"> \
           <div class="btn-group diff-styles" data-toggle="buttons" style="visibility: hidden;"> \
             <button class="btn btn-md btn-swh active unified-diff-button" type="button" onclick="show_unified_diff(event, \'' + diff_data.id + '\')">Unified</button> \
             <button class="btn btn-md btn-swh splitted-diff-button" type="button" onclick="show_splitted_diff(event, \'' + diff_data.id + '\')">Side-by-side</button> \
           </div> \
           <a href="' + diff_data.content_url + '" class="btn btn-md btn-swh" role="button">View file</a> \
         </div> \
         <div class="clearfix"></div> \
       </div> \
       <div id="panel_' + diff_data.id + '_content" class="panel-collapse collapse in"> \
         <div class="swh-diff-loading" id="' + diff_data.id + '-loading" style="text-align: center;visibility: hidden;"> \
           <img src="{% static "img/swh-spinner.gif" %}"></img> \
           <p>Loading diff ...</p> \
         </div> \
         <div class="highlightjs swh-content" style="display: none;" id="' + diff_data.id + '-highlightjs"> \
           <div id="' + diff_data.id + '-unified-diff"> \
             <pre><code class="' + diff_data.id + '" id="' + diff_data.id + '"></code></pre> \
           </div> \
           <div style="width: 100%; display: none;" id="' + diff_data.id + '-splitted-diff"> \
             <pre style="width: 50%; float: left;"><code class="' + diff_data.id + '" id="' + diff_data.id + '-from"></code></pre> \
             <pre style="width: 50%"><code class="' + diff_data.id + '" id="' + diff_data.id + '-to"></code></pre> \
           </div> \
         </div> \
       </div> \
     </div>';
     return diff_panel_html;
   }
 
   // setup waypoints to request diffs computation on the fly while scrolling
   function setup_waypoints() {
     for (var i = 0 ; i < changes.length ; ++i) {
       var diff_data = changes[i];
 
       // create a waypoint that will trigger diff computation when
       // the top of the diff panel hits the bottom of the viewport
       $('#panel_' + diff_data.id).waypoint({
         handler: function() {
           if (is_in_viewport(this.element)) {
             var diff_id = this.element.id.replace('panel_', '');
             compute_diff(diffs_urls[diff_id], diff_id);
             this.destroy();
           }
         },
         offset: '100%'
       });
 
       // create a waypoint that will trigger diff computation when
       // the bottom of the diff panel hits the top of the viewport
       $('#panel_' + diff_data.id).waypoint({
         handler: function() {
           if (is_in_viewport(this.element)) {
             var diff_id = this.element.id.replace('panel_', '');
             compute_diff(diffs_urls[diff_id], diff_id);
             this.destroy();
           }
         },
         offset: function() {
           return -$(this.element).height();
         }
       });
     }
     Waypoint.refreshAll();
   }
 
   // callback when the 'Changes' tab is activated
   $(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
     if (e.target.text == 'Changes') {
 
       $('#readme-panel').css('display', 'none');
 
       if (changes) {
         return;
       }
 
       // request computation of revision file changes list
       // when navigating to the 'Changes' tab and add diff panels
       // to the DOM when receiving the result
       $.ajax({
         url: '{{ diff_revision_url }}',
         dataType: 'json',
         success: function (data) {
 
           changes = data.changes;
           nb_changed_files = data.total_nb_changes;
           var changed_files_text = nb_changed_files + ' changed file';
           if (nb_changed_files != 1) {
             changed_files_text += 's';
           }
           $('#swh-revision-changed-files').text(changed_files_text);
           $('#swh-total-nb-diffs').text(changes.length);
           $('#swh-revision-changes-list pre')[0].innerHTML = data.changes_msg;
 
           $('#swh-revision-changes-loading').css('display', 'none');
           $('#swh-revision-changes-list pre').css('display', 'block');
           $('#swh-compute-all-diffs').css('visibility', 'visible');
           $('#swh-revision-changes-list').removeClass('in');
 
           if (nb_changed_files > changes.length) {
             $('#swh-too-large-revision-diff').css('display', 'block');
             $('#swh-nb-loaded-diffs').text(changes.length);
           }
 
           for (var i = 0 ; i < changes.length ; ++i) {
             var diff_data = changes[i];
             diffs_urls[diff_data.id] = diff_data.diff_url;
             $('#swh-revision-diffs').append(gen_diff_panel(diff_data));
           }
 
           setup_waypoints();
           compute_visible_diffs();
         }
       });
 
     } else if (e.target.text == 'Files') {
       $('#readme-panel').css('display', 'block');
     }
   });
 
   $(document).ready(function() {
 
     {% if message_body|length  > 0 %}
       $('#swh-revision-message').addClass('in');
     {% else %}
       $('#swh-collapse-revision-message').attr('data-toggle', '');
     {% endif %}
 
     var $root = $('html, body');
 
     // callback when the user requests to scroll on a specific diff or back to top
     $('#swh-revision-changes-list a[href^="#"], #back-to-top a[href^="#"]').click(function() {
        var href = $.attr(this, 'href');
        // disable waypoints while scrolling as we do not want to
        // launch computation of diffs the user is not interested in
        // (file changes list can be large)
        Waypoint.disableAll();
 
        $root.animate(
          {
            scrollTop: $(href).offset().top
          },
          {
            duration: 500,
            complete: function () {
              window.location.hash = href;
              // enable waypoints back after scrolling
              Waypoint.enableAll();
              // compute diffs visible in the viewport
              compute_visible_diffs();
            }
        });
 
       return false;
     });
 
   });
 
 </script>
 
 {% endblock %}
 
 {% block swh-browse-after-panels %}
 
 {% include "includes/readme-display.html" %}
 
 {% endblock %}
diff --git a/swh/web/tests/browse/test_utils.py b/swh/web/tests/browse/test_utils.py
index 2088ad4b..4c5b8cb0 100644
--- a/swh/web/tests/browse/test_utils.py
+++ b/swh/web/tests/browse/test_utils.py
@@ -1,429 +1,429 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 # flake8: noqa
 
 import unittest
 
 from unittest.mock import patch
 from nose.tools import istest
 
 
 from swh.web.browse import utils
 from swh.web.common.exc import NotFoundExc
 from swh.web.common.utils import reverse
 from swh.web.tests.testbase import SWHWebTestBase
 
 from .views.data.revision_test_data import revision_history_log_test
 
 
 class SwhBrowseUtilsTestCase(SWHWebTestBase, unittest.TestCase):
 
     @istest
     def get_mimetype_and_encoding_for_content(self):
         text = b'Hello world!'
         self.assertEqual(utils.get_mimetype_and_encoding_for_content(text),
                          ('text/plain', 'us-ascii'))
 
     @patch('swh.web.browse.utils.service')
     @istest
     def get_origin_visits(self, mock_service):
         mock_service.MAX_LIMIT = 2
 
         def _lookup_origin_visits(*args, **kwargs):
             if kwargs['last_visit'] is None:
                 return [{'visit': 1,
                          'date': '2017-05-06T00:59:10+00:00',
                          'metadata': {}},
                         {'visit': 2,
                          'date': '2017-08-06T00:59:10+00:00',
                          'metadata': {}}
                         ]
             else:
                 return [{'visit': 3,
                          'date': '2017-09-06T00:59:10+00:00',
                          'metadata': {}}
                         ]
 
         mock_service.lookup_origin_visits.side_effect = _lookup_origin_visits
 
         origin_info = {
             'id': 1,
             'type': 'git',
             'url': 'https://github.com/foo/bar',
         }
 
         origin_visits = utils.get_origin_visits(origin_info)
 
         self.assertEqual(len(origin_visits), 3)
 
     @patch('swh.web.browse.utils.get_origin_visits')
     @istest
     def get_origin_visit(self, mock_origin_visits):
         origin_info = {
             'id': 2,
             'type': 'git',
             'url': 'https://github.com/foo/bar',
         }
         visits = \
             [{'status': 'full',
               'date': '2015-07-09T21:09:24+00:00',
               'visit': 1,
               'origin': origin_info['id']
               },
              {'status': 'full',
               'date': '2016-02-23T18:05:23.312045+00:00',
               'visit': 2,
               'origin': origin_info['id']
               },
              {'status': 'full',
               'date': '2016-03-28T01:35:06.554111+00:00',
               'visit': 3,
               'origin': origin_info['id']
               },
              {'status': 'full',
               'date': '2016-06-18T01:22:24.808485+00:00',
               'visit': 4,
               'origin': origin_info['id']
               },
              {'status': 'full',
               'date': '2016-08-14T12:10:00.536702+00:00',
               'visit': 5,
               'origin': origin_info['id']
               }]
         mock_origin_visits.return_value = visits
 
         with self.assertRaises(NotFoundExc) as cm:
             visit_id = 12
             visit = utils.get_origin_visit(origin_info,
                                            visit_id=visit_id)
             self.assertIn('Visit with id %s for origin with id %s not found' %
                           (origin_info['id'], visit_id),
                           cm.exception.args[0])
 
         visit = utils.get_origin_visit(origin_info, visit_id=2)
         self.assertEqual(visit, visits[1])
 
         visit = utils.get_origin_visit(
             origin_info, visit_ts='2016-02-23T18:05:23.312045+00:00')
         self.assertEqual(visit, visits[1])
 
         visit = utils.get_origin_visit(
             origin_info, visit_ts='2016-02-20')
         self.assertEqual(visit, visits[1])
 
         visit = utils.get_origin_visit(
             origin_info, visit_ts='2016-06-18T01:22')
         self.assertEqual(visit, visits[3])
 
         visit = utils.get_origin_visit(
             origin_info, visit_ts='2016-06-18 01:22')
         self.assertEqual(visit, visits[3])
 
         visit = utils.get_origin_visit(
             origin_info, visit_ts=1466208000)
         self.assertEqual(visit, visits[3])
 
         visit = utils.get_origin_visit(
             origin_info, visit_ts='2014-01-01')
         self.assertEqual(visit, visits[0])
 
         visit = utils.get_origin_visit(
             origin_info, visit_ts='2018-01-01')
         self.assertEqual(visit, visits[-1])
 
     @patch('swh.web.browse.utils.service')
     @patch('swh.web.browse.utils.get_origin_visit')
     @istest
     def get_origin_visit_snapshot(self, mock_get_origin_visit,
                                   mock_service):
 
         mock_get_origin_visit.return_value = \
             {'status': 'full',
              'date': '2015-08-04T22:26:14.804009+00:00',
              'visit': 1,
              'origin': 1,
              'snapshot': '584b2fe3ce6218a96892e73bd76c2966bbc2a797'}
 
         mock_service.lookup_snapshot.return_value = \
             {'branches': {
                  'refs/heads/master': {
                      'target': '9fbd21adbac36be869514e82e2e98505dc47219c',
                      'target_type': 'revision',
                      'target_url': '/api/1/revision/9fbd21adbac36be869514e82e2e98505dc47219c/'
                  },
                  'refs/tags/0.10.0': {
                      'target': '6072557b6c10cd9a21145781e26ad1f978ed14b9',
                      'target_type': 'release',
                      'target_url': '/api/1/release/6072557b6c10cd9a21145781e26ad1f978ed14b9/'
                  },
                  'refs/tags/0.10.1': {
                      'target': 'ecc003b43433e5b46511157598e4857a761007bf',
                      'target_type': 'release',
                      'target_url': '/api/1/release/ecc003b43433e5b46511157598e4857a761007bf/'
                  }
              },
              'id': '584b2fe3ce6218a96892e73bd76c2966bbc2a797'}
 
         mock_service.lookup_release_multiple.return_value = \
             [{'name': '0.10.0',
               'message': 'release 0.10.0',
               'id': '6072557b6c10cd9a21145781e26ad1f978ed14b9',
               'date': '2015-08-04T13:16:54+03:00',
               'target_type': 'revision',
               'target': 'e9c6243371087d04848b7686888f6dd29dfaef0e'},
              {'name': '0.10.1',
               'message': 'release 0.10.1',
               'id': 'ecc003b43433e5b46511157598e4857a761007bf',
               'date': '2017-08-04T13:16:54+03:00',
               'target_type': 'revision',
               'target': '6072557b6c10cd9a21145781e26ad1f978ed14b9'}]
 
         mock_service.lookup_revision_multiple.return_value = \
             [{'date': '2015-08-04T13:16:54+03:00',
               'directory': '828da2b80e41aa958b2c98526f4a1d2cc7d298b7',
               'id': '9fbd21adbac36be869514e82e2e98505dc47219c',
               'message': 'Merge pull request #678 from algernon'},
              {'date': '2014-04-10T23:01:11-04:00',
               'directory': '2df4cd84ecc65b50b1d5318d3727e02a39b8a4cf',
               'id': '6072557b6c10cd9a21145781e26ad1f978ed14b9',
               'message': '0.10: The "Oh fuck it\'s PyCon" release\n'},
              {'date': '2014-10-10T09:45:23-04:00',
               'directory': '28ba64f97ef709e54838ae482c2da2619a74a0bd',
               'id': 'ecc003b43433e5b46511157598e4857a761007bf',
               'message': '0.10.1\n'}]
 
         expected_result = (
             [{'name': 'refs/heads/master',
               'message': 'Merge pull request #678 from algernon',
               'date': '04 August 2015, 10:16 UTC',
               'revision': '9fbd21adbac36be869514e82e2e98505dc47219c',
               'directory': '828da2b80e41aa958b2c98526f4a1d2cc7d298b7'}],
             [{'name': '0.10.0',
               'id': '6072557b6c10cd9a21145781e26ad1f978ed14b9',
               'message': 'release 0.10.0',
               'date': '04 August 2015, 10:16 UTC',
               'target_type': 'revision',
               'target': 'e9c6243371087d04848b7686888f6dd29dfaef0e',
               'directory': '2df4cd84ecc65b50b1d5318d3727e02a39b8a4cf'},
              {'name': '0.10.1',
               'id': 'ecc003b43433e5b46511157598e4857a761007bf',
               'message': 'release 0.10.1',
               'date': '04 August 2017, 10:16 UTC',
               'target_type': 'revision',
               'target': '6072557b6c10cd9a21145781e26ad1f978ed14b9',
               'directory': '28ba64f97ef709e54838ae482c2da2619a74a0bd'}]
         )
 
         origin_info = {
             'id': 1,
             'type': 'git',
             'url': 'https://github.com/hylang/hy'
         }
 
         origin_visit_branches = \
             utils.get_origin_visit_snapshot(origin_info, visit_id=1)
 
         self.assertEqual(origin_visit_branches, expected_result)
 
     @istest
     def gen_link(self):
         self.assertEqual(utils.gen_link('https://www.softwareheritage.org/', 'SWH'),
                          '<a href="https://www.softwareheritage.org/">SWH</a>')
 
     @istest
     def gen_person_link(self):
         person_id = 8221896
         person_name = 'Antoine Lambert'
         person_url = reverse('browse-person', kwargs={'person_id': person_id})
 
         self.assertEqual(utils.gen_person_link(person_id, person_name),
                          '<a href="%s">%s</a>' % (person_url, person_name))
 
     @istest
     def gen_revision_link(self):
         revision_id = '28a0bc4120d38a394499382ba21d6965a67a3703'
         revision_url = reverse('browse-revision',
                                kwargs={'sha1_git': revision_id})
 
         self.assertEqual(utils.gen_revision_link(revision_id),
                          '<a href="%s">%s</a>' % (revision_url, revision_id))
         self.assertEqual(utils.gen_revision_link(revision_id, shorten_id=True),
                          '<a href="%s">%s</a>' % (revision_url, revision_id[:7]))
 
     @istest
     def prepare_revision_log_for_display_no_contex(self):
         per_page = 10
         first_page_logs_data = revision_history_log_test[:per_page+1]
         second_page_logs_data = revision_history_log_test[per_page:2*per_page+1]
         third_page_logs_data = revision_history_log_test[2*per_page:3*per_page+1]
         last_page_logs_data = revision_history_log_test[3*per_page:3*per_page+5]
 
         revision_log_display_data = utils.prepare_revision_log_for_display(
             first_page_logs_data, per_page, None)
 
         self.assertEqual(revision_log_display_data['revision_log_data'],
                          utils._format_log_entries(first_page_logs_data,
                                                    per_page))
 
         self.assertEqual(revision_log_display_data['prev_rev'],
                          first_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['prev_revs_breadcrumb'],
                          first_page_logs_data[0]['id'])
 
         self.assertEqual(revision_log_display_data['next_rev'], None)
         self.assertEqual(revision_log_display_data['next_revs_breadcrumb'],
                          None)
 
         old_prev_revs_bc = str(revision_log_display_data['prev_revs_breadcrumb'])
 
         revision_log_display_data = utils.prepare_revision_log_for_display(
             second_page_logs_data, per_page, old_prev_revs_bc)
 
         self.assertEqual(revision_log_display_data['revision_log_data'],
                          utils._format_log_entries(second_page_logs_data,
                                                    per_page))
 
         self.assertEqual(revision_log_display_data['prev_rev'],
                          second_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['prev_revs_breadcrumb'],
                          old_prev_revs_bc + '/' + second_page_logs_data[0]['id'])
 
         self.assertEqual(revision_log_display_data['next_rev'],
                          old_prev_revs_bc)
         self.assertEqual(revision_log_display_data['next_revs_breadcrumb'],
                          None)
 
         old_prev_revs_bc = str(revision_log_display_data['prev_revs_breadcrumb'])
 
         revision_log_display_data = utils.prepare_revision_log_for_display(
             third_page_logs_data, per_page, old_prev_revs_bc)
 
         self.assertEqual(revision_log_display_data['revision_log_data'],
                          utils._format_log_entries(third_page_logs_data, per_page))
 
         self.assertEqual(revision_log_display_data['prev_rev'],
                          third_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['prev_revs_breadcrumb'],
                          old_prev_revs_bc + '/' + third_page_logs_data[0]['id'])
 
         self.assertEqual(revision_log_display_data['next_rev'],
                          old_prev_revs_bc.split('/')[-1])
 
         self.assertEqual(revision_log_display_data['next_revs_breadcrumb'],
                          '/'.join(old_prev_revs_bc.split('/')[:-1]))
 
         old_prev_revs_bc = str(revision_log_display_data['prev_revs_breadcrumb'])
 
         revision_log_display_data = utils.prepare_revision_log_for_display(
             last_page_logs_data, per_page, old_prev_revs_bc)
 
         self.assertEqual(revision_log_display_data['revision_log_data'],
                          utils._format_log_entries(last_page_logs_data, per_page))
 
         self.assertEqual(revision_log_display_data['prev_rev'],
                          None)
 
         self.assertEqual(revision_log_display_data['prev_revs_breadcrumb'],
                          None)
 
         self.assertEqual(revision_log_display_data['next_rev'], old_prev_revs_bc.split('/')[-1])
         self.assertEqual(revision_log_display_data['next_revs_breadcrumb'],
                          '/'.join(old_prev_revs_bc.split('/')[:-1]))
 
     @istest
-    def prepare_revision_log_for_display_origin_context(self):
+    def prepare_revision_log_for_display_snapshot_context(self):
         per_page = 10
         first_page_logs_data = revision_history_log_test[:per_page+1]
         second_page_logs_data = revision_history_log_test[per_page:2*per_page+1]
         third_page_logs_data = revision_history_log_test[2*per_page:3*per_page+1]
         last_page_logs_data = revision_history_log_test[3*per_page:3*per_page+5]
 
-        origin_context = {
+        snapshot_context = {
             'origin_info': {'type': 'git',
                             'url': 'https://github.com/git/git'},
             'url_args': {},
             'query_params': {}
         }
 
         revision_log_display_data = utils.prepare_revision_log_for_display(
-            first_page_logs_data, per_page, None, origin_context=origin_context)
+            first_page_logs_data, per_page, None, snapshot_context=snapshot_context)
 
         self.assertEqual(revision_log_display_data['revision_log_data'],
                          utils._format_log_entries(first_page_logs_data,
-                                                   per_page, origin_context=origin_context))
+                                                   per_page, snapshot_context=snapshot_context))
 
         self.assertEqual(revision_log_display_data['prev_rev'],
                          first_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['prev_revs_breadcrumb'],
                          first_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['next_rev'], None)
         self.assertEqual(revision_log_display_data['next_revs_breadcrumb'],
                          None)
 
         old_prev_revs_bc = str(revision_log_display_data['prev_revs_breadcrumb'])
 
         revision_log_display_data = utils.prepare_revision_log_for_display(
-            second_page_logs_data, per_page, old_prev_revs_bc, origin_context=origin_context)
+            second_page_logs_data, per_page, old_prev_revs_bc, snapshot_context=snapshot_context)
 
         self.assertEqual(revision_log_display_data['revision_log_data'],
                          utils._format_log_entries(second_page_logs_data,
-                                                   per_page, origin_context=origin_context))
+                                                   per_page, snapshot_context=snapshot_context))
 
         self.assertEqual(revision_log_display_data['prev_rev'],
                          second_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['prev_revs_breadcrumb'],
                          old_prev_revs_bc + '/' + second_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['next_rev'],
                          old_prev_revs_bc)
         self.assertEqual(revision_log_display_data['next_revs_breadcrumb'],
                          None)
 
         old_prev_revs_bc = str(revision_log_display_data['prev_revs_breadcrumb'])
 
         revision_log_display_data = utils.prepare_revision_log_for_display(
-            third_page_logs_data, per_page, old_prev_revs_bc, origin_context=origin_context)
+            third_page_logs_data, per_page, old_prev_revs_bc, snapshot_context=snapshot_context)
 
         self.assertEqual(revision_log_display_data['revision_log_data'],
                          utils._format_log_entries(third_page_logs_data, per_page,
-                                                   origin_context=origin_context))
+                                                   snapshot_context=snapshot_context))
 
         self.assertEqual(revision_log_display_data['prev_rev'],
                          third_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['prev_revs_breadcrumb'],
                          old_prev_revs_bc + '/' + third_page_logs_data[-1]['id'])
 
         self.assertEqual(revision_log_display_data['next_rev'],
                          old_prev_revs_bc.split('/')[-1])
 
         self.assertEqual(revision_log_display_data['next_revs_breadcrumb'],
                          '/'.join(old_prev_revs_bc.split('/')[:-1]))
 
         old_prev_revs_bc = str(revision_log_display_data['prev_revs_breadcrumb'])
 
         revision_log_display_data = utils.prepare_revision_log_for_display(
-            last_page_logs_data, per_page, old_prev_revs_bc, origin_context=origin_context)
+            last_page_logs_data, per_page, old_prev_revs_bc, snapshot_context=snapshot_context)
 
         self.assertEqual(revision_log_display_data['revision_log_data'],
                          utils._format_log_entries(last_page_logs_data, per_page,
-                                                   origin_context=origin_context))
+                                                   snapshot_context=snapshot_context))
 
         self.assertEqual(revision_log_display_data['prev_rev'],
                          None)
 
         self.assertEqual(revision_log_display_data['prev_revs_breadcrumb'],
                          None)
 
         self.assertEqual(revision_log_display_data['next_rev'], old_prev_revs_bc.split('/')[-1])
         self.assertEqual(revision_log_display_data['next_revs_breadcrumb'],
                          '/'.join(old_prev_revs_bc.split('/')[:-1]))
diff --git a/swh/web/tests/browse/views/data/origin_test_data.py b/swh/web/tests/browse/views/data/origin_test_data.py
index 5869f552..bf3d07b2 100644
--- a/swh/web/tests/browse/views/data/origin_test_data.py
+++ b/swh/web/tests/browse/views/data/origin_test_data.py
@@ -1,740 +1,670 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 # flake8: noqa
 
 origin_info_test_data = {
     'id': 2,
     'type': 'git',
     'url': 'https://github.com/torvalds/linux'
 }
 
 origin_visits_test_data = [
  {'date': '2015-07-09T21:09:24+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': '62841f16e8592344b51afc272b98e98108f0b5c5',
   'status': 'full',
   'visit': 1},
  {'date': '2016-02-23T18:05:23.312045+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': '26befdbf4b393d1e03aa80f2a955bc38b241a8ac',
   'status': 'full',
   'visit': 2},
  {'date': '2016-03-28T01:35:06.554111+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': 'a07fe7f5bfacf1db47450f04340c7a7b45d3da74',
   'status': 'full',
   'visit': 3},
  {'date': '2016-06-18T01:22:24.808485+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': 'ce21f317d9fd74bb4af31b06207240031f4b2516',
   'status': 'full',
   'visit': 4},
  {'date': '2016-08-14T12:10:00.536702+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': 'fe0eac19141fdcdf039e8f5ace5e41b9a2398a49',
   'status': 'full',
   'visit': 5},
  {'date': '2016-08-17T09:16:22.052065+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': '6903f868df6d94a444818b50becd4835b29be274',
   'status': 'full',
   'visit': 6},
  {'date': '2016-08-29T18:55:54.153721+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': '6bd66993839dc897aa15a443c4e3b9164f811499',
   'status': 'full',
   'visit': 7},
  {'date': '2016-09-07T08:44:47.861875+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': 'c06a965f855f4d73c84fbefd859f7df507187d9c',
   'status': 'full',
   'visit': 8},
  {'date': '2016-09-14T10:36:21.505296+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': '40a5381e2b6c0c04775c5b7e7b37284c3affc129',
   'status': 'full',
   'visit': 9},
  {'date': '2016-09-23T10:14:02.169862+00:00',
   'metadata': {},
   'origin': 2,
+  'snapshot': '2252b4d49b9e786eb777a0097a42e51c7193bb9c',
   'status': 'full',
-  'visit': 10},
- {'date': '2017-02-16T07:53:39.467657+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'partial',
-  'visit': 11},
- {'date': '2017-05-04T19:40:09.336451+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 12},
- {'date': '2017-09-07T18:43:13.021746+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 13},
- {'date': '2017-09-09T05:14:33.466107+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 14},
- {'date': '2017-09-09T17:18:54.307789+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 15},
- {'date': '2017-09-10T05:29:01.462971+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 16},
- {'date': '2017-09-10T17:35:20.158515+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 17},
- {'date': '2017-09-11T05:49:58.300518+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 18},
- {'date': '2017-09-11T18:00:15.037345+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 19},
- {'date': '2017-09-12T06:06:34.703343+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 20},
- {'date': '2017-09-12T18:12:35.344511+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 21},
- {'date': '2017-09-13T06:26:36.580675+00:00',
-  'metadata': {},
-  'origin': 2,
-  'status': 'full',
-  'visit': 22}
+  'visit': 10}
 ]
 
 stub_origin_info = {
     'id': 7416001,
     'type': 'git',
     'url': 'https://github.com/webpack/webpack'
 }
 stub_visit_id = 10
 stub_visit_unix_ts = 1493909263
 stub_visit_iso_date = '2017-05-04T14:47:43+00:00'
 
 stub_origin_visits = [
-{'date': '2015-08-05T18:55:20.899865+00:00',
+ {'date': '2015-08-05T18:55:20.899865+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': '23fac03bbf6f4d1037bc1477a85bc1c71e586f98',
   'visit': 1},
  {'date': '2016-03-06T12:16:26.240919+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': 'c71048f1d29a4889ef79f4a64e3c144efe83ea66',
   'visit': 2},
  {'date': '2016-03-21T11:40:10.329221+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': '0d83f0dae76581e55b31ca96d3574261754f1f8f',
   'visit': 3},
  {'date': '2016-03-29T08:05:17.602649+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': 'eeb186a965a6df47327f34997ee164be66340046',
   'visit': 4},
  {'date': '2016-07-26T20:11:03.827577+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': '1bf4bddbcf9be09ffeeaa68a85b53f039b2d32c2',
   'visit': 5},
  {'date': '2016-08-13T04:10:22.142897+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': '57cfa801c5cba9b034f994c119e122fb153da3ec',
   'visit': 6},
  {'date': '2016-08-16T22:57:46.201737+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': 'd0c85af82c4c3abb2024c5c628f3e4b584c8b0ef',
   'visit': 7},
  {'date': '2016-08-17T17:58:43.346437+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': '6ba2ff728eed2777156fd5c89424a2a46609f334',
   'visit': 8},
  {'date': '2016-08-29T23:29:09.445945+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': 'adb6d6adf04454f2b8acd6bf3c89d82dd84c3eed',
   'visit': 9},
  {'date': '2016-09-07T13:49:15.096109+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': '8e29ad8af5f8a9bac86d26f48f956cc0ec69bcd9',
   'visit': 10},
  {'date': '2016-09-14T15:01:09.017257+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': '78fbd0992f12cf1694257b2495e12bd2a3971643',
   'visit': 11},
  {'date': '2016-09-23T12:29:15.921727+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': '4fa28005f67b46f285bebe7228fe0a96a287ad94',
   'visit': 12},
  {'date': '2017-02-16T07:44:23.302439+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'partial',
   'snapshot': None,
   'visit': 13},
  {'date': '2017-05-04T14:47:43.228455+00:00',
   'metadata': {},
   'origin': 7416001,
   'status': 'full',
   'snapshot': 'ea21a9304f34a5b646f81994bd53d580de917427',
   'visit': 14}
 ]
 
 stub_origin_snapshot = (
 [
  {'directory': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'name': 'HEAD',
   'revision': '7bc08e1aa0b08cb23e18715a32aa38517ad34672',
   'date': '04 May 2017, 13:27 UTC',
   'message': 'Merge pull request #4816 from webpack/bugfix/hoist-immutable-export'},
  {'directory': 'c47a824f95109ca7cafdd1c3206332a0d10df55d',
   'name': 'refs/heads/0.10',
   'revision': 'f944553c77254732c4ce22c0add32aa1f641959d',
   'date': '19 June 2013, 12:46 UTC',
   'message': 'webpack 0.10'},
  {'directory': '45e31184ebb7699cd74175145c7eb11cce3f085e',
   'name': 'refs/heads/0.11',
   'revision': '0a29109a6e4579926ebc9b03a6301c61861cce62',
   'date': '31 December 2013, 12:43 UTC',
   'message': '0.11.18'},
  {'directory': '42346b33e2d16019490c273ff586ee88817327b3',
   'name': 'refs/heads/0.8',
   'revision': 'e42701dc6f9b035bfbb5d0fffded905d8b456db4',
   'date': 'e42701dc6f9b035bfbb5d0fffded905d8b456db4',
   'message': 'fixes #54'},
  {'directory': '828c7e9385523f852f8d4dac3cb241e319a9ce61',
   'name': 'refs/heads/0.9',
   'revision': '6c3f51e6d9491a2463ad099a2ca49255ec83ff00',
   'date': '19 March 2013, 07:56 UTC',
   'message': 'updated some small things on the cli'},
  {'directory': '2c50e78d63bdc4441c8d2691f5729b04f0ab3ecd',
   'name': 'refs/heads/1.0',
   'revision': 'fb7958d172e1ef6fb77f23bf56818ad24e896e5c',
   'date': '03 March 2014, 14:37 UTC',
   'message': 'Merge pull request #188 from polotek/patch-1'},
  {'directory': '31a3355c4d0a464aa311c5fa11c7f8b20aede6b4',
   'name': 'refs/heads/IgnorePluginHotfix',
   'revision': 'fdc922a2fa007e71b7ec07252012ffab9a178d4a',
   'date': '08 April 2017, 15:50 UTC',
   'message': 'add tests for ignored context modules'},
  {'directory': 'e566db1fc65cb61b3799c6e0f0ad06b2406f095f',
   'name': 'refs/heads/beta',
   'revision': '40428853da5d9ce6a8751e13b5e54145337b6a7e',
   'date': '04 May 2017, 13:35 UTC',
   'message': 'Merge remote-tracking branch \'origin/perf/chunks-set\' into beta'}
 ],
 [{'name': 'v2.1.0-beta.6',
   'message': '2.1.0-beta.6',
   'date': '22 April 2016, 01:03 UTC',
   'id': 'ae2e1a30e4f2ac701e8a6e2fe85a5f200d7e597a',
   'target_type': 'revision',
   'target': 'ca8b693c2c17bd06778476381fae23b3b21c0475',
   'directory': '4e1f9b3c2f5c4bd205051a14af4ade62349ee57a'},
  {'name': 'v2.1.0-beta.7',
   'message': '2.1.0-beta.7',
   'date': '07 May 2016, 00:00 UTC',
   'id': '46e94bbdc9e54cf6273a985732446b4c963bf1aa',
   'target_type': 'revision',
   'target': '9162f9e6eea62137139f95b8aaedee335c870edd',
   'directory': '713763f90f17371fec714c1660f229ba41b9f5e2'},
  {'name': 'v2.1.0-beta.8',
   'message': '2.1.0-beta.8',
   'date': '29 May 2016, 20:53 UTC',
   'id': '910ada6bf809f8f1c318e098f67f2c0b3c80c888',
   'target_type': 'revision',
   'target': 'abf0cefd592700a19856c3ef9b6d65f905ec73c1',
   'directory': 'd6a069fda992759670851dc38500b2e8dccdc595'},
  {'name': 'v2.1.0-beta.9',
   'message': '2.1.0-beta.9',
   'date': '04 June 2016, 20:19 UTC',
   'id': '63063663c86b0c7e5886adbd3c22aacba9b957b0',
   'target_type': 'revision',
   'target': 'dc3bd055027d8d1ebbb0ebdd07fb73387a0ab6d1',
   'directory': '467251807aea6ba83719194e9a1d65e8053f14e0'}
 ])
 
 stub_origin_master_branch = 'HEAD'
 
 stub_origin_root_directory_sha1 = 'ae59ceecf46367e8e4ad800e231fc76adc3afffb'
 
 stub_origin_root_directory_entries = [
  {'checksums': {'sha1': '1a17dd2c8245559b43a90aa7c084572e917effff',
                 'sha1_git': '012966bd94e648f23b53e71a3f9918e28abc5d81',
                 'sha256': 'd65ab1f8cdb323e2b568a8e99814b1b986a38beed85a380981b383c0feb93525'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 394,
   'name': '.editorconfig',
   'perms': 33188,
   'status': 'visible',
   'target': '012966bd94e648f23b53e71a3f9918e28abc5d81',
   'type': 'file'},
  {'checksums': {'sha1': '2e727ec452dc592ae6038d3e09cd35d83d7ea265',
                 'sha1_git': '291a4e25598633cd7c286ad8d6cbe9eee5a6291a',
                 'sha256': 'd5951c8b796288e0dae1da50575d1b8619462a8df2272cd250146872a1fe804a'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 1839,
   'name': '.eslintrc.js',
   'perms': 33188,
   'status': 'visible',
   'target': '291a4e25598633cd7c286ad8d6cbe9eee5a6291a',
   'type': 'file'},
  {'checksums': {'sha1': '5c59880c0576b2789ec126b61b09fad7a982763b',
                 'sha1_git': 'ac579eb7bc04ba44fe84f3c8d1082573e9f4f514',
                 'sha256': '8a59a61ff6c0f568a8f76bab434baf3318c80a75ef6fb1b6eb861a0c97518de0'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 67,
   'name': '.gitattributes',
   'perms': 33188,
   'status': 'visible',
   'target': 'ac579eb7bc04ba44fe84f3c8d1082573e9f4f514',
   'type': 'file'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': '.github',
   'perms': 16384,
   'target': '93bdcf98e9c05307b39a9d9e00e48cda6dbd036c',
   'type': 'dir'},
  {'checksums': {'sha1': '7e1008eee2a373f0db7746d0416856aec6b95c22',
                 'sha1_git': '84bc35a3abab38bdf87a8f32cc82ce9c136d331e',
                 'sha256': '7de369f1d26bc34c7b6329de78973db07e341320eace6a8704a65d4c5bf5993f'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 167,
   'name': '.gitignore',
   'perms': 33188,
   'status': 'visible',
   'target': '84bc35a3abab38bdf87a8f32cc82ce9c136d331e',
   'type': 'file'},
  {'checksums': {'sha1': '06d96508b7d343ff42868f9b6406864517935da7',
                 'sha1_git': '79b049846744a2da3eb1c4ac3b01543f2bdca44a',
                 'sha256': '697733061d96dd2e061df04dcd86392bb792e2dbe5725a6cb14a436d3c8b76f1'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 706,
   'name': '.jsbeautifyrc',
   'perms': 33188,
   'status': 'visible',
   'target': '79b049846744a2da3eb1c4ac3b01543f2bdca44a',
   'type': 'file'},
  {'checksums': {'sha1': '8041a4a66f46e615c99a850700850a8bd1079dce',
                 'sha1_git': '90e4f1ef5beb167891b2e029da6eb9b14ab17add',
                 'sha256': '3d6a76a57351b9e3acc5843ff2127dc2cf70c023133312143f86ee74ba9ef6d3'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 1059,
   'name': '.travis.yml',
   'perms': 33188,
   'status': 'visible',
   'target': '90e4f1ef5beb167891b2e029da6eb9b14ab17add',
   'type': 'file'},
  {'checksums': {'sha1': 'cd52973e43c6f4294e8cdfd3106df602b9993f20',
                 'sha1_git': 'e5279ebcecd87445648d003c36e6abfebed0ed73',
                 'sha256': '130672b16dff61b1541b6d26c2e568ac11830a31d04faace1583d3ad4a38720e'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 2058,
   'name': 'CONTRIBUTING.md',
   'perms': 33188,
   'status': 'visible',
   'target': 'e5279ebcecd87445648d003c36e6abfebed0ed73',
   'type': 'file'},
  {'checksums': {'sha1': '3bebb9ba92e45dd02a0512e144f6a46b14a9b8ab',
                 'sha1_git': '8c11fc7289b75463fe07534fcc8224e333feb7ff',
                 'sha256': '9068a8782d2fb4c6e432cfa25334efa56f722822180570802bf86e71b6003b1e'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 1071,
   'name': 'LICENSE',
   'perms': 33188,
   'status': 'visible',
   'target': '8c11fc7289b75463fe07534fcc8224e333feb7ff',
   'type': 'file'},
  {'checksums': {'sha1': '6892825420196e84c7104a7ff71ec75db20a1fca',
                 'sha1_git': '8f96a0a6d3bfe7183765938483585f3981151553',
                 'sha256': 'b0170cfc28f56ca718b43ab086ca5428f853268687c8c033b4fbf028c66d663e'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 46700,
   'name': 'README.md',
   'perms': 33188,
   'status': 'visible',
   'target': '8f96a0a6d3bfe7183765938483585f3981151553',
   'type': 'file'},
  {'checksums': {'sha1': '9bc4902b282f9f1c9f8f885a6947f3bf0f6e6e5f',
                 'sha1_git': 'dd6912c8fc97eff255d64da84cfd9837ebf0a05a',
                 'sha256': 'e06dbc101195ec7ea0b9aa236be4bdc03784a01f64d6e11846ce3a3f6e1080c6'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 590,
   'name': 'appveyor.yml',
   'perms': 33188,
   'status': 'visible',
   'target': 'dd6912c8fc97eff255d64da84cfd9837ebf0a05a',
   'type': 'file'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'benchmark',
   'perms': 16384,
   'target': '6bd2996b76e051982aa86499a2b485594e607fe3',
   'type': 'dir'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'bin',
   'perms': 16384,
   'target': '681da97ea1ce9a2bd29e3e72781d80e8b961cd51',
   'type': 'dir'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'buildin',
   'perms': 16384,
   'target': '35cfb25d1b3a4063bf04a43f9cbb7e1e87703708',
   'type': 'dir'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'ci',
   'perms': 16384,
   'target': 'efccd3ce0a0304c8cbcffcfdfcafcf1e598819b8',
   'type': 'dir'},
  {'checksums': {'sha1': '9eb3d0e3711f68f82d29785e64ebff2c0d7cec7a',
                 'sha1_git': '1ecf877e445bcf865ef53cfcecadda7e9691aace',
                 'sha256': '2007e0883c2784bb82584a10d53a0f0c36286dd913741bfd5e4d22b812db529c'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 529,
   'name': 'circle.yml',
   'perms': 33188,
   'status': 'visible',
   'target': '1ecf877e445bcf865ef53cfcecadda7e9691aace',
   'type': 'file'},
  {'checksums': {'sha1': '63209428718e101492c3bb91509f1b4e319b0d7d',
                 'sha1_git': 'b3fa4e6abe22977e6267e9969a593e790bf2cd36',
                 'sha256': '5d14c8d70215f46a9722d29c7ebff8cc9bd24509650d7ee601fd461e52a52f7f'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 254,
   'name': 'codecov.yml',
   'perms': 33188,
   'status': 'visible',
   'target': 'b3fa4e6abe22977e6267e9969a593e790bf2cd36',
   'type': 'file'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'examples',
   'perms': 16384,
   'target': '7e3ac01795317fbc36a031a9117e7963d6c7da90',
   'type': 'dir'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'hot',
   'perms': 16384,
   'target': 'a5eea6ca952fba9f7ae4177627ed5e22754df9f5',
   'type': 'dir'},
  {'checksums': {'sha1': '92d9367db4ba049f698f5bf78b6946b8e2d91345',
                 'sha1_git': 'eaa9cc4a247b01d6a9c0adc91997fefe6a62be1f',
                 'sha256': 'd4b42fa0651cf3d99dea0ca5bd6ba64cc21e80be7d9ea05b2b4423ef8f16ec36'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 19,
   'name': 'input.js',
   'perms': 33188,
   'status': 'visible',
   'target': 'eaa9cc4a247b01d6a9c0adc91997fefe6a62be1f',
   'type': 'file'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'lib',
   'perms': 16384,
   'target': '187d40104aa21475d8af88ccd77fc582cf6ac7a6',
   'type': 'dir'},
  {'checksums': {'sha1': 'f17ffa2dc14262292e2275efa3730a96fe060c44',
                 'sha1_git': 'd55b7110929cbba3d94da01494a272b39878ac0f',
                 'sha256': '012d4446ef8ab6656251b1b7f8e0217a5666ec04ad952e8a617b70946de17166'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 9132,
   'name': 'open-bot.yaml',
   'perms': 33188,
   'status': 'visible',
   'target': 'd55b7110929cbba3d94da01494a272b39878ac0f',
   'type': 'file'},
  {'checksums': {'sha1': '3a6638e72fcc2499f1a4c9b46d4d00d239bbe1c8',
                 'sha1_git': '6d1aa82c90ecd184d136151eb81d240e1fea723e',
                 'sha256': '00faf7dde1eb0742f3ca567af4dbcd8c01a38cf30d8faa7f0208f46dbc6b5201'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 4034,
   'name': 'package.json',
   'perms': 33188,
   'status': 'visible',
   'target': '6d1aa82c90ecd184d136151eb81d240e1fea723e',
   'type': 'file'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'schemas',
   'perms': 16384,
   'target': 'f1f89c389f73c29e7a5d1a0ce5f9e0f166857815',
   'type': 'dir'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'test',
   'perms': 16384,
   'target': '318c279189d186a1e06653fc5c78c539878c4d7d',
   'type': 'dir'},
  {'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': None,
   'name': 'web_modules',
   'perms': 16384,
   'target': '93a5cc8e492d0b0323386814a72536381019ef7b',
   'type': 'dir'},
  {'checksums': {'sha1': '8047389fcc8e286ceed5536c677c2e803032cf84',
                 'sha1_git': 'eb8509f70158c231a3fd864aecf2649590bbedf3',
                 'sha256': '8cbe1ce94349ac3bc6cbcc952efd45d838c6b4524af8a773b18e1ebe8b4f936b'},
   'dir_id': 'ae59ceecf46367e8e4ad800e231fc76adc3afffb',
   'length': 141192,
   'name': 'yarn.lock',
   'perms': 33188,
   'status': 'visible',
   'target': 'eb8509f70158c231a3fd864aecf2649590bbedf3',
   'type': 'file'}
 ]
 
 stub_origin_sub_directory_path = 'lib/webworker'
 
 stub_origin_sub_directory_entries = [
  {'checksums': {'sha1': '7bf366cd9f4a9835c73aafb70e44f640bab7ad16',
                 'sha1_git': '870252b7a175ee5ec2edfe2c22b2d56aa04bece4',
                 'sha256': 'e0af438932627dd9d53b36bfe69c3dbad6dc4d4569f6cdb29d606c9df2b128fa'},
   'dir_id': '02b626051e0935ecd28f50337f452db76803f980',
   'length': 921,
   'name': 'WebWorkerChunkTemplatePlugin.js',
   'perms': 33188,
   'status': 'visible',
   'target': '870252b7a175ee5ec2edfe2c22b2d56aa04bece4',
   'type': 'file'},
  {'checksums': {'sha1': 'e2862b2787702bd3eb856f73627d5d8df5a8b550',
                 'sha1_git': 'b3e90d26a68ad9da0a7cc97a262db585fa4c73ba',
                 'sha256': '1c254e76248ff5ec7e2185cdb1cfd2e0338087244d2d617a868c346317b7646b'},
   'dir_id': '02b626051e0935ecd28f50337f452db76803f980',
   'length': 1039,
   'name': 'WebWorkerHotUpdateChunkTemplatePlugin.js',
   'perms': 33188,
   'status': 'visible',
   'target': 'b3e90d26a68ad9da0a7cc97a262db585fa4c73ba',
   'type': 'file'},
  {'checksums': {'sha1': 'a1e04061d3e50bb8c024b07e9464da7392f37bf1',
                 'sha1_git': '1e503e028fdd5322c9f7d8ec50f54006cacf334e',
                 'sha256': '72dea06510d1a4435346f8dca20d8898a394c52c7382a97bd73d1840e31f90b3'},
   'dir_id': '02b626051e0935ecd28f50337f452db76803f980',
   'length': 1888,
   'name': 'WebWorkerMainTemplate.runtime.js',
   'perms': 33188,
   'status': 'visible',
   'target': '1e503e028fdd5322c9f7d8ec50f54006cacf334e',
   'type': 'file'},
  {'checksums': {'sha1': 'b95c16e90784cf7025352839133b482149526da0',
                 'sha1_git': '46c9fe382d606ce19e556deeae6a23af47a8027d',
                 'sha256': 'c78c7ca9ee0aa341f843a431ef27c75c386607be3037d44ff530bfe3218edb3c'},
   'dir_id': '02b626051e0935ecd28f50337f452db76803f980',
   'length': 4051,
   'name': 'WebWorkerMainTemplatePlugin.js',
   'perms': 33188,
   'status': 'visible',
   'target': '46c9fe382d606ce19e556deeae6a23af47a8027d',
   'type': 'file'},
  {'checksums': {'sha1': 'ec9df36b1e8dd689d84dbeeeb9f45fe9f9d96605',
                 'sha1_git': 'd850018bb0d2ad41dd0ae9e5c887dff8a23601e9',
                 'sha256': 'f995f6a13511955244850c2344c6cef09c10ab24c49f8448544e2b34aa69d03c'},
   'dir_id': '02b626051e0935ecd28f50337f452db76803f980',
   'length': 763,
   'name': 'WebWorkerTemplatePlugin.js',
   'perms': 33188,
   'status': 'visible',
   'target': 'd850018bb0d2ad41dd0ae9e5c887dff8a23601e9',
   'type': 'file'}
 ]
 
 stub_content_origin_info = {
     'id': 10357753,
     'type': 'git',
     'url': 'https://github.com/KDE/kate'
 }
 
 stub_content_origin_visit_id = 10
-stub_content_origin_visit_unix_ts = 1494032350
-stub_content_origin_visit_iso_date = '2017-05-06T00:59:10+00:00'
+stub_content_origin_visit_unix_ts = 1471457439
+stub_content_origin_visit_iso_date = '2016-08-17T18:10:39+00'
 
 stub_content_origin_branch = 'HEAD'
 
 stub_content_origin_visits = [
  {'date': '2015-09-26T09:30:52.373449+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': 'bdaf9ac436488a8c6cda927a0f44e172934d3f65',
   'status': 'full',
   'visit': 1},
  {'date': '2016-03-10T05:36:11.118989+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': '2ab1ee17cbaf6fd477832ace039ad85ade748e70',
   'status': 'full',
   'visit': 2},
  {'date': '2016-03-24T07:39:29.727793+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': 'e8f19fe946c251fd69989dabe66a9d1b2cba00f6',
   'status': 'full',
   'visit': 3},
  {'date': '2016-03-31T22:55:31.402863+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': '34a10743dca51484098931a6cf6933582013b458',
   'status': 'full',
   'visit': 4},
  {'date': '2016-05-26T06:25:54.879676+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': 'd8c98ebdf07b2b6542bd74501334b4760b223f9d',
   'status': 'full',
   'visit': 5},
  {'date': '2016-06-07T17:16:33.964164+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': '6d8747764f926c8608be3c37f3fe2e516faf5bf2',
   'status': 'full',
   'visit': 6},
  {'date': '2016-07-27T01:38:20.345358+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': '9fed7618f1b022bcca931c6d29db57b18d843b07',
   'status': 'full',
   'visit': 7},
  {'date': '2016-08-13T04:46:45.987508+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': '4d7cfa75c52152122050914b88ef07a63a8dad9d',
   'status': 'full',
   'visit': 8},
  {'date': '2016-08-16T23:24:13.214496+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': 'bfa9790e0bfad52322acf4d348b97bbc5534db8b',
   'status': 'full',
   'visit': 9},
  {'date': '2016-08-17T18:10:39.841005+00:00',
   'metadata': {},
   'origin': 10357753,
+  'snapshot': 'bfa9790e0bfad52322acf4d348b97bbc5534db8b',
   'status': 'full',
-  'visit': 10},
- {'date': '2016-08-30T17:28:02.476486+00:00',
-  'metadata': {},
-  'origin': 10357753,
-  'status': 'full',
-  'visit': 11},
- {'date': '2016-09-08T09:32:37.152054+00:00',
-  'metadata': {},
-  'origin': 10357753,
-  'status': 'full',
-  'visit': 12},
- {'date': '2016-09-15T09:47:37.758093+00:00',
-  'metadata': {},
-  'origin': 10357753,
-  'status': 'full',
-  'visit': 13},
- {'date': '2016-12-04T06:14:02.688518+00:00',
-  'metadata': {},
-  'origin': 10357753,
-  'status': 'full',
-  'visit': 14},
- {'date': '2017-02-16T08:45:57.719974+00:00',
-  'metadata': {},
-  'origin': 10357753,
-  'status': 'partial',
-  'visit': 15},
- {'date': '2017-05-06T00:59:10.495727+00:00',
-  'metadata': {},
-  'origin': 10357753,
-  'status': 'full',
-  'visit': 16}
+  'visit': 10}
 ]
 
 stub_content_origin_snapshot = (
 [
  {'directory': '08e8329257dad3a3ef7adea48aa6e576cd82de5b',
   'name': 'HEAD',
   'revision': '11f15b0789344427ddf17b8d75f38577c4395ce0',
   'date': '02 May 2017, 05:33 UTC',
   'message': 'GIT_SILENT made messages (after extraction)'},
  {'directory': '2371baf0411e3adf12d65daf86c3b135633dd5e4',
   'name': 'refs/heads/Applications/14.12',
   'revision': '5b27ad32f8c8da9b6fc898186d59079488fb74c9',
   'date': '23 February 2015, 12:10 UTC',
   'message': 'SVN_SILENT made messages (.desktop file)'},
  {'directory': '5d024d33a218eeb164936301a2f89231d1f0854a',
   'name': 'refs/heads/Applications/15.04',
   'revision': '4f1e29120795ac643044991e91f24d02c9980202',
   'date': '04 July 2015, 12:34 UTC',
   'message': 'SVN_SILENT made messages (.desktop file)'},
  {'directory': 'f33984df50ec29dbbc86295adb81ebb831e3b86d',
   'name': 'refs/heads/Applications/15.08',
   'revision': '52722e588f46a32b480b5f304ba21480fc8234b1',
   'date': '12 June 2016, 20:28 UTC',
   'message': 'Correctly restore view config of all split views'},
  {'directory': 'e706b836cf32929a48b6f92c07766f237f9d068f',
   'name': 'refs/heads/Applications/15.12',
   'revision': '38c4e42c4a653453fc668c704bb8995ae31b5baf',
   'date': '06 September 2016, 12:01 UTC',
   'message': 'Fix crash in tab switcher plugin when using split views'},
  {'directory': 'ebf8ae783b44df5c827bfa46227e5dbe98f25eb4',
   'name': 'refs/heads/Applications/16.04',
   'revision': 'd0fce3b880ab37a551d75ec940137e0f46bf2143',
   'date': '06 September 2016, 12:01 UTC',
   'message': 'Fix crash in tab switcher plugin when using split views'}
 ],
 [{'name': 'v4.9.90',
   'message': 'KDE 4.9.90',
   'date': '09 December 2012, 23:15 UTC',
   'id': 'f6a3a31474a86023377ce6fa1cbec3d9ab809d06',
   'target_type': 'revision',
   'target': '4dd3d7de2f684fcdf27028bafdc022183e33610d',
   'directory': 'a5b9c74c35732189b8aa7567f979f9ac36fdb8bc'},
  {'name': 'v4.9.95',
   'message': 'KDE 4.9.95',
   'date': '02 January 2013, 19:00 UTC',
   'id': '74bab04b34b243269354f6e5530d6d0edf92f84d',
   'target_type': 'revision',
   'target': '6bd42579908cf62f094ebca0e100832208967428',
   'directory': 'aaeba0a71293465b9026249381c0a1f13a13a43f'},
  {'name': 'v4.9.97',
   'message': 'KDE 4.9.97',
   'date': '05 January 2013, 20:34 UTC',
   'id': 'd8bf93d6915c4ab17de882c443423f281c961a1c',
   'target_type': 'revision',
   'target': '5fbd023fc46ecc57a6772be2aa04f532e8426f43',
   'directory': '0ce36caec34ad7c930f35eca907148208b2a3f2b'},
  {'name': 'v4.9.98',
   'message': 'KDE 4.9.98',
   'date': '21 January 2013, 19:36 UTC',
   'id': '9bf0265d4fce650926bfd93b117584eb3fd0bd73',
   'target_type': 'revision',
   'target': '670aff3a940fecf6a085fe71a5bead2edcad8a55',
   'directory': '0747fbcc783dfab9e857040287ed400df145079d'}
 ])
diff --git a/swh/web/tests/browse/views/test_origin.py b/swh/web/tests/browse/views/test_origin.py
index b1e13b34..7f5e0943 100644
--- a/swh/web/tests/browse/views/test_origin.py
+++ b/swh/web/tests/browse/views/test_origin.py
@@ -1,720 +1,722 @@
 # Copyright (C) 2017-2018  The Software Heritage developers
 # See the AUTHORS file at the top-level directory of this distribution
 # License: GNU General Public License version 3, or any later version
 # See top-level LICENSE file for more information
 
 # flake8: noqa
 
 from unittest.mock import patch
 from nose.tools import istest, nottest
 
 from django.test import TestCase
 from django.utils.html import escape
 
 from swh.web.common.exc import NotFoundExc
 from swh.web.common.utils import (
     reverse, gen_path_info, format_utc_iso_date,
     parse_timestamp
 )
 from swh.web.tests.testbase import SWHWebTestBase
 
 from .data.origin_test_data import (
     origin_info_test_data,
     origin_visits_test_data,
     stub_content_origin_info, stub_content_origin_visit_id,
     stub_content_origin_visit_unix_ts, stub_content_origin_visit_iso_date,
     stub_content_origin_branch,
     stub_content_origin_visits, stub_content_origin_snapshot,
     stub_origin_info, stub_visit_id,
     stub_origin_visits, stub_origin_snapshot,
     stub_origin_root_directory_entries, stub_origin_master_branch,
     stub_origin_root_directory_sha1, stub_origin_sub_directory_path,
     stub_origin_sub_directory_entries, stub_visit_unix_ts, stub_visit_iso_date
 )
 
 from .data.content_test_data import (
     stub_content_root_dir,
     stub_content_text_data,
     stub_content_text_path
 )
 
 
 class SwhBrowseOriginTest(SWHWebTestBase, TestCase):
 
     @patch('swh.web.browse.views.origin.get_origin_visits')
     @patch('swh.web.browse.views.origin.service')
     @istest
     def origin_browse(self, mock_service, mock_get_origin_visits):
         mock_service.lookup_origin.return_value = origin_info_test_data
         mock_get_origin_visits.return_value = origin_visits_test_data
 
         url = reverse('browse-origin',
                       kwargs={'origin_type': origin_info_test_data['type'],
                               'origin_url': origin_info_test_data['url']})
         resp = self.client.get(url)
 
         self.assertEquals(resp.status_code, 200)
         self.assertTemplateUsed('origin.html')
         self.assertContains(resp, '<pre>%s</pre>' % origin_info_test_data['type'])
         self.assertContains(resp, '<pre><a href="%s">%s</a></pre>' %
                                   (origin_info_test_data['url'],
                                    origin_info_test_data['url']))
 
         self.assertContains(resp, '<td class="swh-origin-visit">',
                             count=len(origin_visits_test_data))
 
         for visit in origin_visits_test_data:
             visit_date_iso = format_utc_iso_date(visit['date'], '%Y-%m-%dT%H:%M:%SZ')
             visit_date = format_utc_iso_date(visit['date'])
             browse_url = reverse('browse-origin-directory',
                                  kwargs={'origin_type': origin_info_test_data['type'],
                                          'origin_url': origin_info_test_data['url'],
                                          'timestamp': visit_date_iso})
             self.assertContains(resp, 'href="%s">%s</a>' %
                                 (browse_url, visit_date))
 
     @nottest
     def origin_content_view_test(self, origin_info, origin_visits,
                                  origin_branches, origin_releases,
                                  origin_branch,
                                  root_dir_sha1, content_sha1,
                                  content_path, content_data,
                                  content_language,
                                  visit_id=None, timestamp=None):
 
         url_args = {'origin_type': origin_info['type'],
                     'origin_url': origin_info['url'],
                     'path': content_path}
 
         if not visit_id:
             visit_id = origin_visits[-1]['visit']
 
         query_params = {}
 
         if timestamp:
             url_args['timestamp'] = timestamp
 
         if visit_id:
             query_params['visit_id'] = visit_id
 
         url = reverse('browse-origin-content',
                       kwargs=url_args,
                       query_params=query_params)
 
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 200)
         self.assertTemplateUsed('content.html')
 
         self.assertContains(resp, '<code class="%s">' % content_language)
         self.assertContains(resp, escape(content_data))
 
         split_path = content_path.split('/')
 
         filename = split_path[-1]
         path = content_path.replace(filename, '')[:-1]
 
         path_info = gen_path_info(path)
 
         del url_args['path']
 
         if timestamp:
             url_args['timestamp'] = \
                 format_utc_iso_date(parse_timestamp(timestamp).isoformat(),
                                     '%Y-%m-%dT%H:%M:%S')
 
         root_dir_url = reverse('browse-origin-directory',
                                kwargs=url_args,
                                query_params=query_params)
 
         self.assertContains(resp, '<li class="swh-path">',
                             count=len(path_info)+1)
 
 
         self.assertContains(resp, '<a href="%s">%s</a>' %
                             (root_dir_url, root_dir_sha1[:7]))
 
         for p in path_info:
             url_args['path'] = p['path']
             dir_url = reverse('browse-origin-directory',
                               kwargs=url_args,
                               query_params=query_params)
             self.assertContains(resp, '<a href="%s">%s</a>' %
                                 (dir_url, p['name']))
 
         self.assertContains(resp, '<li>%s</li>' % filename)
 
         query_string = 'sha1_git:' + content_sha1
 
         url_raw = reverse('browse-content-raw',
                           kwargs={'query_string': query_string},
                           query_params={'filename': filename})
         self.assertContains(resp, url_raw)
 
         del url_args['path']
 
         origin_branches_url = \
                 reverse('browse-origin-branches',
                         kwargs=url_args,
                         query_params=query_params)
 
         self.assertContains(resp, '<a href="%s">Branches (%s)</a>' %
             (origin_branches_url, len(origin_branches)))
 
         origin_releases_url = \
                 reverse('browse-origin-releases',
                         kwargs=url_args,
                         query_params=query_params)
 
         self.assertContains(resp, '<a href="%s">Releases (%s)</a>' %
             (origin_releases_url, len(origin_releases)))
 
         self.assertContains(resp, '<li class="swh-branch">',
                             count=len(origin_branches))
 
         url_args['path'] = content_path
 
         for branch in origin_branches:
             query_params['branch'] = branch['name']
             root_dir_branch_url = \
                 reverse('browse-origin-content',
                         kwargs=url_args,
                         query_params=query_params)
 
         self.assertContains(resp, '<a href="%s">' % root_dir_branch_url)
 
         self.assertContains(resp, '<li class="swh-release">',
                             count=len(origin_releases))
 
         query_params['branch'] = None
         for release in origin_releases:
             query_params['release'] = release['name']
             root_dir_release_url = \
                 reverse('browse-origin-content',
                         kwargs=url_args,
                         query_params=query_params)
 
             self.assertContains(resp, '<a href="%s">' % root_dir_release_url)
 
     @patch('swh.web.browse.utils.get_origin_visits')
     @patch('swh.web.browse.utils.get_origin_visit_snapshot')
-    @patch('swh.web.browse.views.origin.service')
+    @patch('swh.web.browse.views.utils.snapshot_context.service')
     @patch('swh.web.browse.utils.service')
-    @patch('swh.web.browse.views.origin.request_content')
+    @patch('swh.web.browse.views.utils.snapshot_context.request_content')
     @istest
     def origin_content_view(self, mock_request_content, mock_utils_service,
                             mock_service, mock_get_origin_visit_snapshot,
                             mock_get_origin_visits):
 
         stub_content_text_sha1 = stub_content_text_data['checksums']['sha1']
         mock_get_origin_visits.return_value = stub_content_origin_visits
         mock_get_origin_visit_snapshot.return_value = stub_content_origin_snapshot
         mock_service.lookup_directory_with_path.return_value = \
             {'target': stub_content_text_sha1}
         mock_request_content.return_value = stub_content_text_data
         mock_utils_service.lookup_origin.return_value = stub_content_origin_info
 
         self.origin_content_view_test(stub_content_origin_info,
                                       stub_content_origin_visits,
                                       stub_content_origin_snapshot[0],
                                       stub_content_origin_snapshot[1],
                                       stub_content_origin_branch,
                                       stub_content_root_dir,
                                       stub_content_text_sha1,
                                       stub_content_text_path,
                                       stub_content_text_data['raw_data'],
                                       'cpp')
 
         self.origin_content_view_test(stub_content_origin_info,
                                       stub_content_origin_visits,
                                       stub_content_origin_snapshot[0],
                                       stub_content_origin_snapshot[1],
                                       stub_content_origin_branch,
                                       stub_content_root_dir,
                                       stub_content_text_sha1,
                                       stub_content_text_path,
                                       stub_content_text_data['raw_data'],
                                       'cpp',
                                       visit_id=stub_content_origin_visit_id)
 
         self.origin_content_view_test(stub_content_origin_info,
                                       stub_content_origin_visits,
                                       stub_content_origin_snapshot[0],
                                       stub_content_origin_snapshot[1],
                                       stub_content_origin_branch,
                                       stub_content_root_dir,
                                       stub_content_text_sha1,
                                       stub_content_text_path,
                                       stub_content_text_data['raw_data'],
                                       'cpp',
                                       timestamp=stub_content_origin_visit_unix_ts)
 
         self.origin_content_view_test(stub_content_origin_info,
                                       stub_content_origin_visits,
                                       stub_content_origin_snapshot[0],
                                       stub_content_origin_snapshot[1],
                                       stub_content_origin_branch,
                                       stub_content_root_dir,
                                       stub_content_text_sha1,
                                       stub_content_text_path,
                                       stub_content_text_data['raw_data'],
                                       'cpp',
                                       timestamp=stub_content_origin_visit_iso_date)
 
     @nottest
     def origin_directory_view(self, origin_info, origin_visits,
                               origin_branches, origin_releases, origin_branch,
                               root_directory_sha1, directory_entries,
                               visit_id=None, timestamp=None, path=None):
 
         dirs = [e for e in directory_entries
                 if e['type'] == 'dir']
         files = [e for e in directory_entries
                  if e['type'] == 'file']
 
         if not visit_id:
             visit_id = origin_visits[-1]['visit']
 
         url_args = {'origin_type': origin_info['type'],
                     'origin_url': origin_info['url']}
 
         query_params = {}
 
         if timestamp:
             url_args['timestamp'] = timestamp
         else:
             query_params['visit_id'] = visit_id
 
         if path:
             url_args['path'] = path
 
         url = reverse('browse-origin-directory',
                       kwargs=url_args,
                       query_params=query_params)
 
         resp = self.client.get(url)
 
         self.assertEquals(resp.status_code, 200)
         self.assertTemplateUsed('directory.html')
         self.assertContains(resp, '<td class="swh-directory">',
                             count=len(dirs))
         self.assertContains(resp, '<td class="swh-content">',
                             count=len(files))
 
         if timestamp:
             url_args['timestamp'] = \
                 format_utc_iso_date(parse_timestamp(timestamp).isoformat(),
                                     '%Y-%m-%dT%H:%M:%S')
 
         for d in dirs:
             dir_path = d['name']
             if path:
                 dir_path = "%s/%s" % (path, d['name'])
             dir_url_args = dict(url_args)
             dir_url_args['path'] = dir_path
             dir_url = reverse('browse-origin-directory',
                               kwargs=dir_url_args,
                               query_params=query_params)
             self.assertContains(resp, dir_url)
 
         for f in files:
             file_path = f['name']
             if path:
                 file_path = "%s/%s" % (path, f['name'])
             file_url_args = dict(url_args)
             file_url_args['path'] = file_path
             file_url = reverse('browse-origin-content',
                                kwargs=file_url_args,
                                query_params=query_params)
             self.assertContains(resp, file_url)
 
         if 'path' in url_args:
             del url_args['path']
 
         root_dir_branch_url = \
             reverse('browse-origin-directory',
                     kwargs=url_args,
                     query_params=query_params)
 
         nb_bc_paths = 1
         if path:
             nb_bc_paths = len(path.split('/')) + 1
 
         self.assertContains(resp, '<li class="swh-path">', count=nb_bc_paths)
         self.assertContains(resp, '<a href="%s">%s</a>' %
                                   (root_dir_branch_url,
                                    root_directory_sha1[:7]))
 
         origin_branches_url = \
                 reverse('browse-origin-branches',
                         kwargs=url_args,
                         query_params=query_params)
 
         self.assertContains(resp, '<a href="%s">Branches (%s)</a>' %
             (origin_branches_url, len(origin_branches)))
 
         origin_releases_url = \
                 reverse('browse-origin-releases',
                         kwargs=url_args,
                         query_params=query_params)
 
         self.assertContains(resp, '<a href="%s">Releases (%s)</a>' %
             (origin_releases_url, len(origin_releases)))
 
         if path:
             url_args['path'] = path
 
         self.assertContains(resp, '<li class="swh-branch">',
                             count=len(origin_branches))
 
         for branch in origin_branches:
             query_params['branch'] = branch['name']
             root_dir_branch_url = \
                 reverse('browse-origin-directory',
                         kwargs=url_args,
                         query_params=query_params)
 
             self.assertContains(resp, '<a href="%s">' % root_dir_branch_url)
 
         self.assertContains(resp, '<li class="swh-release">',
                             count=len(origin_releases))
 
         query_params['branch'] = None
         for release in origin_releases:
             query_params['release'] = release['name']
             root_dir_release_url = \
                 reverse('browse-origin-directory',
                         kwargs=url_args,
                         query_params=query_params)
 
             self.assertContains(resp, '<a href="%s">' % root_dir_release_url)
         self.assertContains(resp, 'vault-cook-directory')
         self.assertContains(resp, 'vault-cook-revision')
 
     @patch('swh.web.browse.utils.get_origin_visits')
     @patch('swh.web.browse.utils.get_origin_visit_snapshot')
     @patch('swh.web.browse.utils.service')
     @patch('swh.web.browse.views.origin.service')
     @istest
     def origin_root_directory_view(self, mock_origin_service,
                                    mock_utils_service,
                                    mock_get_origin_visit_snapshot,
                                    mock_get_origin_visits):
 
         mock_get_origin_visits.return_value = stub_origin_visits
         mock_get_origin_visit_snapshot.return_value = stub_origin_snapshot
         mock_utils_service.lookup_directory.return_value = \
             stub_origin_root_directory_entries
         mock_utils_service.lookup_origin.return_value = stub_origin_info
 
         self.origin_directory_view(stub_origin_info, stub_origin_visits,
                                    stub_origin_snapshot[0],
                                    stub_origin_snapshot[1],
                                    stub_origin_master_branch,
                                    stub_origin_root_directory_sha1,
                                    stub_origin_root_directory_entries)
 
         self.origin_directory_view(stub_origin_info, stub_origin_visits,
                                    stub_origin_snapshot[0],
                                    stub_origin_snapshot[1],
                                    stub_origin_master_branch,
                                    stub_origin_root_directory_sha1,
                                    stub_origin_root_directory_entries,
                                    visit_id=stub_visit_id)
 
         self.origin_directory_view(stub_origin_info, stub_origin_visits,
                                    stub_origin_snapshot[0],
                                    stub_origin_snapshot[1],
                                    stub_origin_master_branch,
                                    stub_origin_root_directory_sha1,
                                    stub_origin_root_directory_entries,
                                    timestamp=stub_visit_unix_ts)
 
         self.origin_directory_view(stub_origin_info, stub_origin_visits,
                                    stub_origin_snapshot[0],
                                    stub_origin_snapshot[1],
                                    stub_origin_master_branch,
                                    stub_origin_root_directory_sha1,
                                    stub_origin_root_directory_entries,
                                    timestamp=stub_visit_iso_date)
 
     @patch('swh.web.browse.utils.get_origin_visits')
     @patch('swh.web.browse.utils.get_origin_visit_snapshot')
     @patch('swh.web.browse.utils.service')
-    @patch('swh.web.browse.views.origin.service')
+    @patch('swh.web.browse.views.utils.snapshot_context.service')
     @istest
     def origin_sub_directory_view(self, mock_origin_service,
                                   mock_utils_service,
                                   mock_get_origin_visit_snapshot,
                                   mock_get_origin_visits):
 
         mock_get_origin_visits.return_value = stub_origin_visits
         mock_get_origin_visit_snapshot.return_value = stub_origin_snapshot
         mock_utils_service.lookup_directory.return_value = \
             stub_origin_sub_directory_entries
         mock_origin_service.lookup_directory_with_path.return_value = \
             {'target': '120c39eeb566c66a77ce0e904d29dfde42228adb'}
         mock_utils_service.lookup_origin.return_value = stub_origin_info
 
         self.origin_directory_view(stub_origin_info, stub_origin_visits,
                                    stub_origin_snapshot[0],
                                    stub_origin_snapshot[1],
                                    stub_origin_master_branch,
                                    stub_origin_root_directory_sha1,
                                    stub_origin_sub_directory_entries,
                                    path=stub_origin_sub_directory_path)
 
         self.origin_directory_view(stub_origin_info, stub_origin_visits,
                                    stub_origin_snapshot[0],
                                    stub_origin_snapshot[1],
                                    stub_origin_master_branch,
                                    stub_origin_root_directory_sha1,
                                    stub_origin_sub_directory_entries,
                                    visit_id=stub_visit_id,
                                    path=stub_origin_sub_directory_path)
 
         self.origin_directory_view(stub_origin_info, stub_origin_visits,
                                    stub_origin_snapshot[0],
                                    stub_origin_snapshot[1],
                                    stub_origin_master_branch,
                                    stub_origin_root_directory_sha1,
                                    stub_origin_sub_directory_entries,
                                    timestamp=stub_visit_unix_ts,
                                    path=stub_origin_sub_directory_path)
 
         self.origin_directory_view(stub_origin_info, stub_origin_visits,
                                    stub_origin_snapshot[0],
                                    stub_origin_snapshot[1],
                                    stub_origin_master_branch,
                                    stub_origin_root_directory_sha1,
                                    stub_origin_sub_directory_entries,
                                    timestamp=stub_visit_iso_date,
                                    path=stub_origin_sub_directory_path)
 
-    @patch('swh.web.browse.views.origin.request_content')
+    @patch('swh.web.browse.views.utils.snapshot_context.request_content')
     @patch('swh.web.browse.utils.get_origin_visits')
     @patch('swh.web.browse.utils.get_origin_visit_snapshot')
     @patch('swh.web.browse.utils.service')
     @patch('swh.web.browse.views.origin.service')
+    @patch('swh.web.browse.views.utils.snapshot_context.service')
     @istest
-    def origin_request_errors(self, mock_origin_service,
+    def origin_request_errors(self, mock_snapshot_service,
+                              mock_origin_service,
                               mock_utils_service,
                               mock_get_origin_visit_snapshot,
                               mock_get_origin_visits,
                               mock_request_content):
 
         mock_origin_service.lookup_origin.side_effect = \
             NotFoundExc('origin not found')
         url = reverse('browse-origin',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar'})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
-        self.assertContains(resp, "origin not found", status_code=404)
+        self.assertContains(resp, 'origin not found', status_code=404)
 
         mock_utils_service.lookup_origin.side_effect = None
         mock_utils_service.lookup_origin.return_value = origin_info_test_data
         mock_get_origin_visits.return_value = []
         url = reverse('browse-origin-directory',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar'})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
         self.assertContains(resp, "No SWH visit", status_code=404)
 
         mock_get_origin_visits.return_value = stub_origin_visits
         mock_get_origin_visit_snapshot.side_effect = \
             NotFoundExc('visit not found')
         url = reverse('browse-origin-directory',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar'},
                       query_params={'visit_id': len(stub_origin_visits)+1})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
         self.assertRegex(resp.content.decode('utf-8'), 'Visit.*not found')
 
         mock_get_origin_visits.return_value = stub_origin_visits
         mock_get_origin_visit_snapshot.side_effect = None
         mock_get_origin_visit_snapshot.return_value = ([], [])
         url = reverse('browse-origin-directory',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar'})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
         self.assertRegex(resp.content.decode('utf-8'),
                          'Origin.*has an empty list of branches')
 
         mock_get_origin_visit_snapshot.return_value = stub_origin_snapshot
         mock_utils_service.lookup_directory.side_effect = \
             NotFoundExc('Directory not found')
         url = reverse('browse-origin-directory',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar'})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
         self.assertContains(resp, 'Directory not found', status_code=404)
 
         mock_origin_service.lookup_origin.side_effect = None
         mock_origin_service.lookup_origin.return_value = origin_info_test_data
         mock_get_origin_visits.return_value = []
         url = reverse('browse-origin-content',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar',
                               'path': 'foo'})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
         self.assertContains(resp, "No SWH visit", status_code=404)
 
         mock_get_origin_visits.return_value = stub_origin_visits
         mock_get_origin_visit_snapshot.side_effect = \
             NotFoundExc('visit not found')
         url = reverse('browse-origin-content',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar',
                               'path': 'foo'},
                       query_params={'visit_id': len(stub_origin_visits)+1})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
         self.assertRegex(resp.content.decode('utf-8'), 'Visit.*not found')
 
         mock_get_origin_visits.return_value = stub_origin_visits
         mock_get_origin_visit_snapshot.side_effect = None
         mock_get_origin_visit_snapshot.return_value = ([], [])
         url = reverse('browse-origin-content',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar',
                               'path': 'baz'})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
         self.assertRegex(resp.content.decode('utf-8'),
                          'Origin.*has an empty list of branches')
 
         mock_get_origin_visit_snapshot.return_value = stub_origin_snapshot
-        mock_origin_service.lookup_directory_with_path.return_value = \
+        mock_snapshot_service.lookup_directory_with_path.return_value = \
             {'target': stub_content_text_data['checksums']['sha1']}
         mock_request_content.side_effect = \
             NotFoundExc('Content not found')
         url = reverse('browse-origin-content',
                       kwargs={'origin_type': 'foo',
                               'origin_url': 'bar',
                               'path': 'baz'})
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 404)
         self.assertTemplateUsed('error.html')
         self.assertContains(resp, 'Content not found', status_code=404)
 
 
     @patch('swh.web.browse.utils.get_origin_visits')
     @patch('swh.web.browse.utils.get_origin_visit_snapshot')
     @patch('swh.web.browse.utils.service')
     @patch('swh.web.browse.views.origin.service')
     @istest
     def origin_branches(self, mock_origin_service,
                         mock_utils_service,
                         mock_get_origin_visit_snapshot,
                         mock_get_origin_visits):
         mock_get_origin_visits.return_value = stub_origin_visits
         mock_get_origin_visit_snapshot.return_value = stub_origin_snapshot
         mock_utils_service.lookup_origin.return_value = stub_origin_info
 
         url_args = {'origin_type': stub_origin_info['type'],
                     'origin_url': stub_origin_info['url']}
 
         url = reverse('browse-origin-branches',
                       kwargs=url_args)
 
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 200)
         self.assertTemplateUsed('branches.html')
 
         origin_branches = stub_origin_snapshot[0]
         origin_releases = stub_origin_snapshot[1]
 
         origin_branches_url = \
                 reverse('browse-origin-branches',
                         kwargs=url_args)
 
         self.assertContains(resp, '<a href="%s">Branches (%s)</a>' %
             (origin_branches_url, len(origin_branches)))
 
         origin_releases_url = \
                 reverse('browse-origin-releases',
                         kwargs=url_args)
 
         self.assertContains(resp, '<a href="%s">Releases (%s)</a>' %
             (origin_releases_url, len(origin_releases)))
 
         self.assertContains(resp, '<tr class="swh-origin-branch">',
                             count=len(origin_branches))
 
         for branch in origin_branches:
             browse_branch_url = reverse('browse-origin-directory',
                                         kwargs={'origin_type': stub_origin_info['type'],
                                                 'origin_url': stub_origin_info['url']},
                                         query_params={'branch': branch['name']})
             self.assertContains(resp, '<a href="%s">%s</a>' % (escape(browse_branch_url), branch['name']))
 
             browse_revision_url = reverse('browse-revision',
                                           kwargs={'sha1_git': branch['revision']},
                                           query_params={'origin_type': stub_origin_info['type'],
                                                         'origin_url': stub_origin_info['url']})
             self.assertContains(resp, '<a href="%s">%s</a>' % (escape(browse_revision_url), branch['revision'][:7]))
 
 
     @patch('swh.web.browse.utils.get_origin_visits')
     @patch('swh.web.browse.utils.get_origin_visit_snapshot')
     @patch('swh.web.browse.utils.service')
     @patch('swh.web.browse.views.origin.service')
     @istest
     def origin_releases(self, mock_origin_service,
                         mock_utils_service,
                         mock_get_origin_visit_snapshot,
                         mock_get_origin_visits):
         mock_get_origin_visits.return_value = stub_origin_visits
         mock_get_origin_visit_snapshot.return_value = stub_origin_snapshot
         mock_utils_service.lookup_origin.return_value = stub_origin_info
 
         url_args = {'origin_type': stub_origin_info['type'],
                     'origin_url': stub_origin_info['url']}
 
         url = reverse('browse-origin-releases',
                       kwargs=url_args)
 
         resp = self.client.get(url)
         self.assertEquals(resp.status_code, 200)
         self.assertTemplateUsed('releases.html')
 
         origin_branches = stub_origin_snapshot[0]
         origin_releases = stub_origin_snapshot[1]
 
         origin_branches_url = \
                 reverse('browse-origin-branches',
                         kwargs=url_args)
 
         self.assertContains(resp, '<a href="%s">Branches (%s)</a>' %
             (origin_branches_url, len(origin_branches)))
 
         origin_releases_url = \
                 reverse('browse-origin-releases',
                         kwargs=url_args)
 
         self.assertContains(resp, '<a href="%s">Releases (%s)</a>' %
             (origin_releases_url, len(origin_releases)))
 
         self.assertContains(resp, '<tr class="swh-origin-release">',
                             count=len(origin_releases))
 
         for release in origin_releases:
             browse_release_url = reverse('browse-release',
                                          kwargs={'sha1_git': release['id']},
                                          query_params={'origin_type': stub_origin_info['type'],
                                                        'origin_url': stub_origin_info['url']})
             self.assertContains(resp, '<a href="%s">%s</a>' % (escape(browse_release_url), release['name']))